Can't install xdebug on Mac with Homebrew

前端 未结 11 815
小蘑菇
小蘑菇 2020-12-24 01:31

I\'m kind of new to using Homebrew, but I love it. It\'s so easy. I\'m trying install Xdebug. Some of the posts on the web say to do this:

brew install xd         


        
11条回答
  •  温柔的废话
    2020-12-24 01:57

    // Working as of 2020

    Edit: Well at least something is still working this year.
     

    As homebrew removed the extra php repository containing a version with xdebug already installed, you have to install it manually.

    Summary:

    1. brew install for php
    2. update your path
    3. pecl install xdebug for xdebug

    Full example:

    # update homebrew
    brew update
    
    # install a version of php, e.g. 7.0
    brew install php@7.0
    
    # now they tell you how to link it, in my case
    echo 'export PATH="/usr/local/opt/php@7.0/bin:$PATH"' >> ~/.bash_profile
    echo 'export PATH="/usr/local/opt/php@7.0/sbin:$PATH"' >> ~/.bash_profile
    
    # reload the file with the updated path, so we can use pecl
    source ~/.bash_profile
    
    # check that the path is to the correct php executable,
    # and pecl is available
    which pecl
    # returns: /usr/local/opt/php@7.0/bin/pecl
    
    # install xdebug, see https://xdebug.org/docs/install#pecl
    pecl install xdebug
    
    # check that everything worked
    php --version
    # should show a xdebug version
    # like:  with Xdebug v2.6.0, Copyright (c) 2002-2018, by Derick Rethans
    

    The pecl install xdebug step above ended with

    Build process completed successfully
    Installing '/usr/local/Cellar/php@7.0/7.0.30/pecl/20151012/xdebug.so'
    install ok: channel://pecl.php.net/xdebug-2.6.0
    Extension xdebug enabled in php.ini
    

    So I didn't even need to enable the xdebug.so in php.ini.

提交回复
热议问题