Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install xdebug on El Capitan with homebrew

Dumb question I think, but I have PHP 5.6.14 running on El Capitan.

I have installed xdebug with

brew install php56-xdebug

But there is no mention of xdebug in phpinfo

phpinfo reveals:

Configuration File (php.ini) Path:  /etc

When I run brew install php56-xdebug again, I get

homebrew/php/php56-xdebug-2.3.3 already installed

So I'm guessing that brew has installed xdebug on a path (where?) which is for a different version of PHP which I'm not actually running.

Can somebody help me understand what brew has done, and how I can configure the version of PHP that I'm running to include xdebug.

like image 426
xanld Avatar asked Sep 27 '22 03:09

xanld


2 Answers

OK, so I fixed this. Any comments welcome on whether I did it right.

1) Found where the brew install of php is using

brew info php56

This reports:

To enable PHP in Apache add the following to httpd.conf and restart Apache:

LoadModule php5_module /usr/local/opt/php56/libexec/apache2/libphp5.so

Update version of php loaded by apache:

sudo nano /etc/apache2/httpd.conf

Replaced

LoadModule php5_module libexec/apache2/libphp5.so

with

LoadModule php5_module /usr/local/opt/php56/libexec/apache2/libphp5.so
like image 69
xanld Avatar answered Oct 26 '22 22:10

xanld


For those who use different version of php type in terminal

--> brew search xdebug

and choose yours version.

after installing your version of xdebug you've to active it by placing the installed extension path to your php.ini file.

print your phpinfo() and look for "Loaded Configuration File".

Open the file shown for "Loaded Configuration File" ( mine is /etc/php.ini ) and paste extension path anywhere you like.

for me the xdebug installed extension path is "/usr/local/Cellar/php56-xdebug/2.5.1/xdebug.so"

so i pasted {zend_extension="/usr/local/Cellar/php56-xdebug/2.5.1/xdebug.so"}.

restart your apache server and check your phpinfo() for xdebug, thats all.

like image 38
sh6210 Avatar answered Oct 27 '22 00:10

sh6210