I've installed PHP 7 on my mac using Homebrew i.e.
$ brew install php70
Also I want to have the the XDebug setup on my machine.
Ideally I would love to have an easy solution like using brew again, but unfortunately it seems there is no such formula exist (at least yet), and the latest package is homebrew/php/php56-xdebug
.
I thought before start the manual installation, check here to see if there are any other workaround.
Any advice will be greatly appreciated.
To install Xdebug for PHP7 on Ubuntu you will need to do so manually. Ubuntu 15 and lower will not come with a package for PHP7 or its xDebug counterpart. First, be sure you are using PHP 7 already by checking your version. PHP 7.0.0-2+deb.sury.org~trusty+1 (cli) ( NTS ) Copyright (c) 1997-2015 The PHP Group ...
If Xdebug does not show up, or you get a warning from PHP that an xdebug.so file or similar was not found, you might need to use the full path instead of just zend_extension=xdebug, such as zend_extension=/usr/lib/php/20190902/xdebug.so.
You can check your version using php -v. Then, run pecl install xdebug. Once it's finished installing, you'll see a message like this: Then go to your php.ini (which you can find by running php --ini, and add these two lines to it: Obviously, change the path to whatever was printed by the pecl xdebug installation.
We’ll assume that you have already installed PHP Tools for your macOS, but if you haven’t, you’ll find a tutorial right here. Xdebug can be found on its webpage and it’s also hosted on Github. The source code can be downloaded from both locations. For this tutorial, we have downloaded it directly from the Xdebug page here.
First, make sure you're on the version of PHP for which you want Xdebug installed. It needs to be installed separately for each major version (7.0 vs 7.1 vs 7.2). You can check your version using php -v
.
Then, run pecl install xdebug
.
Once it's finished installing, you'll see a message like this:
Installing '/usr/local/Cellar/php/7.2.8/pecl/20170718/xdebug.so'
Then go to your php.ini (which you can find by running php --ini
, and add these two lines to it:
zend_extension="/usr/local/Cellar/php/7.2.8/pecl/20170718/xdebug.so"
xdebug.remote_enable=on
Obviously, change the path to whatever was printed by the pecl xdebug installation.
As stated by Homebrew, Homebrew/php tag was deprecated.
So it's not possible to install xdebug through Homebrew anymore. Please use PECL instead: https://xdebug.org/docs/install#pecl
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With