Can't Install Xdebug On Mac With Homebrew


Answer :

Add this repository: https://github.com/josegonzalez/homebrew-php#readme

Then use brew install php54-xdebug for PHP 5.4

Or brew install php53-xdebug for PHP 5.3

Or brew install php55-xdebug for PHP 5.5


// Working as of 2021

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

Summary:

  1. brew install <php version> 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.


Forget about homebrew for a moment. I have tried doing with it and it is not a that good idea stability-wise. Instead stick to the default installation guide:

Installing XDebug on Mac OSX

  1. Go to http://xdebug.org/wizard.php and paste your phpinfo() content there.
  2. Download xdebug-2.2.5.tgz (http://xdebug.org/files/xdebug-2.2.5.tgz)
  3. Unpack the downloaded file with:

    tar -xvzf xdebug-2.2.5.tgz

  4. Run:

    cd xdebug-2.2.5

  5. Run phpize (install it via homebrew if you don't have it already)

    phpize

  6. As part of its output it should show (If it does not, you are using the wrong phpize):

    Configuring for: ...
    Zend Module Api No: 20100525
    Zend Extension Api No: 220100525

  7. Run:

    ./configure

  8. Run:

    make

  9. Run:

    cp modules/xdebug.so /usr/lib/php/extensions/no-debug-non-zts-20100525

  10. Edit /etc/php.ini and add the line:

    zend_extension = /usr/lib/php/extensions/no-debug-non-zts-20100525/xdebug.so

  11. Restart the web server by typing in the terminal:

    sudo apachectl restart


Comments

Popular posts from this blog

Are Regular VACUUM ANALYZE Still Recommended Under 9.1?

Can Feynman Diagrams Be Used To Represent Any Perturbation Theory?