Eclipse PDT Debugging Setup (XDebug / Zend)

I had a time with Eclipse debugging a CakePHP application. I've tried reading a few tutorials (none of which were as great). I've tried using Zend and XDebug.

I'm not even sure exactly how I should use this thing once it is configured correctly.

I tried to set a breakpoint in my PHP code by right clicking the PHP file in a text editor and selecting "debug php web application", but it never hits the breakpoint. It opens a browser in eclipse with some GET parameters tied to my normal urls:

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 was not sure about in my php project debug properties is the PHP executable field. It was automatically set to "none", so I had to create an entry pointing to "/ usr / bin / php". Maybe this is not true?

I got as far as creating a simple application with one php file that only had a few echo expressions. I can't get the debugger to hit a breakpoint in this.

Here's my phpinfo (): https://sites.google.com/site/kylephpinfo/phpinfo.html?attredirects=0&d=1

I've never had so many problems getting the debugger to work in my life.

+3


source to share


2 answers


From the look of your php.ini, the debugger extension didn't load. It usually displays right below the first field, something like with Xdebug v2.1.0, Copyright (c) 2002-2008, by Derick Rethans

...

So the first thing you need to do is make sure your PHP ini server is configured correctly. Find the php.ini pointed to by httpd.conf 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

    stands for Thread Safe, so make sure the package you got for the debugger is also ts

    .
  • The setup is very similar to Linux / Mac and with a .so debugger extension.
  • The easiest way to get it right is probably to set up a server like XAMPP that supports compatible debugger extensions.


Once you've done that, and php.info shows xdebug (or Zend Debugger) loaded, you're ready to go.

If your server is on your local machine, the easiest way is to create a project inside htdocs. This will prevent any source lookup issues when the debugger tries to resolve breakpoints and when the PDT tries to open the correct file. (there are settings path mapping

you can manipulate, but that will save you the trouble).

Don't be confused with executable PHP debug (PHP Script debugger). You need to start remote debugging (even if it's on the same computer). PHP script is intended only for simple PHP scripts that run as is (not on the server, and as CLI).

Hope this helps you get started! :)

Update: after Php 5.3 no need to use zend_extension_ts, instead use zend_extension only as stated on Php.net http://php.net/manual/en/ini.core.php#ini.zend-extension

+6


source


When you debug, does it open a second copy of the file? If so, it drops the remote version for debugging, and you will need to set a breakpoint on that file.



0


source







All Articles