views:

742

answers:

2

I try using xdebug with NetBeans to debug PHP. I start debug, and NetBeans waits for ever for a connection with xdebug. I have NetBeans 6.8 (latest version) with the latest MAMP package installed on my mac.

My php.ini looks like this:

[xdebug]
;zend_extension="/Applications/MAMP/bin/php5/lib/php/extensions/no-debug-non-zts-20060613/xdebug.so"
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=localhost
xdebug.remote_port=9000
+2  A: 

If your php.ini really looks like what you posted, you have to un-comment the zend_extension line (i.e. remove the ';' at its begninning), so Xdebug is actually loaded.

Then, make sure Xdebug is loaded, calling phpinfo() from a PHP file (just to be sure).

After that : I suppose there should be some options to configure the debugger in netbeans ? If so, is netbeans listening on port 9000 ? (The one you configured in php.ini)

Pascal MARTIN
Must I restart all servers after changing php.ini? Did uncomment that, and checked NetBeans settings. Port 9000 is right. But NetBeans also mentions an Session ID: "netbeans-xdebug". Do I have to provide that somewhere in php.ini?
openfrog
You'll have to at least restart Apache (modifications to php.ini are only taken into account when Apache starts) ; for the Session ID, there is a xdebug.idekey setting (see http://xdebug.org/docs/remote ) ; not sure it'll do the trick, but it might -- never remember having set, though ; I suppose the default value is fine with Eclipse PDT (I usually use eclipse PDT, and not netbeans)
Pascal MARTIN
A: 

Finally, I had to add the idekey value like this:

xdebug.idekey="netbeans-xdebug"

now it works :-)

openfrog
Note: I choose Pascal MARTIN's Answer as the accepted one, because without enabling xdebug by uncommenting it, my idekey thing would not do anything anyways ;-) (besides that I feel bad accepting my own answer so I just don't do it)
openfrog
Thanks for your answer anyway : this can prove useful to others !
Pascal MARTIN
I hope it will :-) probably you were right, this idekey is by default fine for Eclipse.
openfrog