?

Log in

No account? Create an account

Previous Entry | Next Entry

I run Apache 2.x on Windows XP and just got interactive PHP debugging working with Xdebug and Eclipse as the IDE. (Running on the same machine; no Zend debugger is needed.)



get Xdebug:
xdebug.org has binary downloads. check phpinfo() to see what version of PHP you're running, then grab the appropriate version of the DLL. Save it in php/ext.

edit php.ini:
I load the module as thread-safe extenison (_ts) since phpinfo() indicates Thread Safety: enabled.

zend_extension_ts="C:/users/htdocs/php/ext/php_xdebug-5.2.x-2.0.2.dll"

[xdebug]
xdebug.remote_enable=on
xdebug.default_enable=on
xdebug.remote_port=9019
xdebug.remote_host=127.0.0.1
xdebug.remote_handler=dbgp
;; remote_mode:
; req - will try to connect to the debug client as soon as the script starts.
; jit - will only try to connect to the debug client as soon as an error condition occurs.
xdebug.remote_mode=req


Restart Apache; check phpinfo() output to see that Xdebug is getting loaded. I had some trouble with this; not sure in the end what made the difference.

setting up Eclipse:
Window > Preferences > PHP > Debug > PHP Debugger : XDebug
Window > Preferences > PHP > Debug > Installed Debuggers > Xdebug : set the port number
Window > Preferences > PHP > PHP Servers > Default PHP Web Server : Edit this if it's not localhost
(I left the rest on the default settings, I believe)

and:
don't forget to open the appropriate port (9000, or whatever you're using) in your firewall if you're running one.

to start debugging:
Main toolbar > bug icon dropdown > Debug as > PHP Web Page