enable xdebug in php 8 macos monterey 2022

    By: Manu
    2 years ago
    Category: PHPViews: 140

    Alright devs lets enable xdebug in php 8 on macos. So first of all we need to open terminal and run below given commands. So here is how our system looks like now

    There is no information about Xdebug here.

    Run this command

    // Intel based cpu 
    
    pecl install xdebug
    
    // M1 based cpu
    
    arch -x86_64 sudo pecl install xdebug
    

    It will install xdebug

    Great now check the php info again. using

    php --version
    

    Now we have xdebug there yeah awesome.



    Incase you need to set config in ini file

    here is what you need to add

    zend_extension = /usr/local/lib/php/pecl/20210902/xdebug.so 
    xdebug.mode = debug
    xdebug.start_with_request = yes
    xdebug.client_port = 9000
    

    Zend_extension path might differ check using

    cd /usr/local/lib/php/pecl
    

    Here you will see a folder and inside it xdebug.so

    just update accordingly as in our case folder name was "20210902".

    so we added

    /usr/local/lib/php/pecl/20210902/xdebug.so