[UPHPU] Remote debugging with Xdebug on a Mac

Richard K Miller richardkmiller at gmail.com
Thu Apr 16 17:00:47 MDT 2009


I reinstalled Xdebug today and was glad to rediscover it. It finally  
"clicked" for me. (Installation was easy from MacPorts -- "sudo port  
install php5-xdebug".)

I'm trying to find a good solution for remote debugging. The concept  
(which I just learned) is that your desktop debugging program listens  
on port 9000 for connections from your local web server. Then when you  
load a web page in your browser, the Xdebug extension, running in  
Apache, communicates to your desktop program and allows you to step  
through the code, set breakpoints, examine variables, etc.

I tried MacGDBp[1] and liked it, but it was buggy. Too many freezes  
and blank screens. Hard to blame an open-source program written by a  
19-year-old college student. Wow. When that app matures, it will be  
killer.

I'm currently trying NetBeans. There's a Mac version specifically for  
PHP development and I'm impressed how easy it was to get started.  
However, I don't know how to make NetBeans listen for Xdebug  
connections. I can select "Debug Project" but that launches my  
browser. I'm debugging AJAX calls so I don't want NetBeans to launch  
the browser. I just want NetBeans to listen. (I've enabled autostart  
in my php.ini file: "xdebug.remote_autostart=1" to make this  
possible.) Can NetBeans do it?

Does anyone currently use Xdebug for remote debugging, especially on a  
Mac? A command-line utility would be fine too, as long as it will  
allow me to step through code, set breakpoints, and examine variables.

Richard

P.S. Here are the relevant lines from my php.ini file, if it helps  
anyone:
zend_extension="/opt/local/lib/php/extensions/no-debug-non- 
zts-20060613/xdebug.so"
xdebug.remote_autostart=1
xdebug.remote_enable=1
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000

[1] http://www.bluestatic.org/software/macgdbp/



More information about the UPHPU mailing list