Reputation: 1445
I've been having a hell of a time getting Eclipse to debug my CakePHP application. I've tried reading through several tutorials (none of which were that great). I've tried using both Zend and XDebug.
I'm not even sure on exactly how I'm supposed to be using this thing once it's set up properly.
I tried setting a break point in my PHP code, right-clicking the PHP file in the text editor, and selecting 'debug php web application', but it never hits the break point. It opens up a browser within eclipse with some GET parameters attached to my normal URL:
?debug_host=192.168.1.2%2C127.0.0.1&start_debug=1&debug_port=10000&original_url=http%3A%2F%2Flocalhost%2Fparticipants&send_sess_end=1&debug_stop=1&debug_start_session=1&debug_no_cache=1331422177353&debug_session_id=1000
One thing I wasn't sure about in my project php debugging properties was the PHP executable field. It was automatically set to 'none', so I had to create an entry that pointed to '/usr/bin/php'. Maybe this isn't correct?
I went as far as creating a simple application with one php file that just had a few echo statements. I can't get the debugger to hit a breakpoint in that either.
Here's my phpinfo(): https://sites.google.com/site/kylephpinfo/phpinfo.html?attredirects=0&d=1
I've never had so much trouble getting a debugger to work in my life..
Upvotes: 3
Views: 2998
Reputation: 3838
From the looks of your php.ini, the debugger extension did not load. It's usually displayed right under the first box, as something like with Xdebug v2.1.0, Copyright (c) 2002-2008, by Derick Rethans
...
So, the first thing you'll need to make sure is that your server's PHP ini is set up correctly. Locate the php.ini that the httpd.conf is pointing to, and edit it to include something like this:
zend_extension_ts=C:\php\ext\php_xdebug-2.1.0-5.3.0.dll
xdebug.remote_enable=1
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_handler="dbgp"
Notes:
ts
means Thread Safe, so make sure that the package you got for the debugger is also ts
.Once you get it going, and the php.info shows the xdebug (or Zend Debugger) loaded, you are ready to go.
In case you have your server in your local machine, the easiest way is to create your project inside the htdocs. That will prevent any issues with source lookup when the debugger is trying to resolve breakpoints, and when the PDT tries to resolve the right file to open.
(there are path mapping
settings you can manipulate, but this will save you the trouble).
Don't get confused by the PHP executable debugging (the PHP Script debugger). You need to run a remote debug (even if it's on the same machine). The PHP Script is only for simple PHP scripts, running as is (not on a server, and like CLI).
Hope that will help you get started! :)
Update: After Php 5.3 no need to use zend_extension_ts, instead use zend_extension only as mentioned on Php.net http://php.net/manual/en/ini.core.php#ini.zend-extension
Upvotes: 6
Reputation: 1295
When you do the debugging does it open up a second copy of the file? If so, it is pulling down the remote version to debug against and you will need to set your breakpoint in that file.
Upvotes: 0