Installing Xdebug on Mac Mountain Lion (10.8.3)
Even though I’m running Mountain Lion (10.8.3) which comes with Xdebug I couldn’t get the PHP (5.4.14) local web server to register that Xdebug was actually installed and enabled.
My php.ini had the already installed Xdebug extension enabled:
But whenever I inspected
phpinfo() there wasn’t any mention of Xdebug.
Luckily the website has a wizard where you can paste the output of phpinfo(). From there you get detailed instructions on how to download, configure and make the latest version of Xdebug. It’s pretty simple.
Essentially the steps are as follows:
- Download xdebug-2.2.3.tgz
- Unpack the downloaded file with
tar -xvzf xdebug-2.2.3.tgz
phpize(Any problems…see the FAQ)
sudo mkdir -p /usr/lib/php/extensions/no-debug-non-zts-20100525
sudo cp modules/xdebug.so /usr/lib/php/extensions/no-debug-non-zts-20100525
- Update your /etc/php.ini and uncomment/add the line
zend_extension = /usr/lib/php/extensions/no-debug-non-zts-20100525/xdebug.so
- Restart the webserver
Now if you check the output of phpinfo() you should see Xdebug.
To make sure your debug output is being styled properly, make sure you have
html_errors = On in php.ini (it defaults to Off).