Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable XDebug extension on my php?

Tags:

php

I am running php on a macbook pro running mountain lion. Mountain lion comes with XDebug pre-installed, so based on a tutorial I've found , I made three steps. First I've uncomment this line in my php.ini :

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

Secondly I've uncomment this line in my php.ini :

xdebug.remote_enable=1

And finally I restarted the apache server with :

sudo apachectl restart

The problem is that I see no xdebug appearing in my php details when I run a phpinfo(). Thank you.

PS : The path of the above xdebug.so file is correct.

like image 970
skiabox Avatar asked Nov 23 '12 19:11

skiabox


2 Answers

I am answering my own question because Mountain Lion is a special case when it comes to running XDebug.

As you can see here, mountain lion comes with an older xdebug.so library. So the user must re-compile the library himself.

Here is how to do it.

  1. Download the latest version here. (We get the file under the source link.)
  2. Unpack the downloaded file with tar -xvzf xdebug-2.2.1.tgz
  3. Run cd xdebug-2.2.1
  4. Run phpize
  5. Run ./configure
  6. Run make
  7. Run sudo cp modules/xdebug.so /usr/lib/php/extensions/no-debug-non-zts-20090626
  8. Restart the web server with sudo apachectl restart
like image 138
skiabox Avatar answered Oct 04 '22 21:10

skiabox


Check you are editing the same php.ini that shows up in phpinfo() in the broswer.

Here are my settings (I'm also on a Macbook Pro on Mountain Lion btw):

xdebug.var_display_max_children = 999
xdebug.var_display_max_data = 99999
xdebug.var_display_max_depth = 100


;zend_extension_ts=php_xdebug.dll
xdebug.remote_enable=On
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_handler=dbgp

Works for me. Does any of that help?

like image 34
Paul Avatar answered Oct 04 '22 19:10

Paul