Debugging PHP in Aptana 2.0

screenm0nkey picture screenm0nkey · May 19, 2010 · Viewed 8.2k times · Source

I'm a real newbie when it comes to PHP debugging so forgive my stupidity. I have a simple html form that submits to a PHP script and I want to debug that script and see what's being sent from the form.

My Aptana has two two PHP interpreters installed; Zend Debugger on port 10001 and XDebug on 9000

I have the Firefox Aptana Addon installed

I have my HTML page on the following url, running locally;

http://3i/latest.html

In the IDE I open the PHP script and add some breakpoints, I then open the latest.html and I click on the debug button. It launches the HTML page in a local webserver running at;

http://127.0.0.1:8000/3i/latest.html

I then fill out the form and submit at which point the debugger tells me the JS Debugger has terminated but it doesn't stop at my break points.

I've had a good read around and I can't find anything which helps me, which makes me think it's something pretty easy and I'm being a bit dumb.

Answer

Jarrod Nettles picture Jarrod Nettles · May 25, 2010

You say that you have both XDebug and Zend debug installed - did you make the appropriate modifications to your local php.ini? You can't have both running at the same time - debuggers act as application controllers, communicating with your web server and giving it orders to stop, pause, or continue execution of your script and having two of them configured at the same time can cause unexpected debugging behavior like you described.

Assuming you want XDebug, you would open up php.ini, search for [XDebug] (or [Zend]). Comment out all the zend_* options and put the following options in:

[XDebug]
;; Only Zend OR (!) XDebug
zend_extension_ts="C:\xampp\php\ext\php_xdebug.dll"
xdebug.remote_enable=true
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.profiler_enable=1
xdebug.profiler_output_dir="C:\xampp\tmp"

Yes, I know I'm on Windows at the moment - don't splutter. Replace the extension path with the appropriate path to XDebug on your server. If you are wanting to use Zend Debugger then it is much the same, just disable XDebug. Don't forget to restart your web server.

EDIT - I may have been unclear; you can have both installed, you just can't have both running at the same time.