Jump to content

How to debug PHP?


Recommended Posts

Hi guys,


I am relatively new to this environment.


I have been doing some PHP coding using XAMPP and Eclipse IDE. I seem to have installed pdt-2.0.0GA_debugger-5.2.15.v20081217-all-in-one-win32.zip which should include some kind of debugger but I'm not sure how to enable it for use.


So far, I have been ok with 'echo' method which is unacceptable as the code became more complex.


Could someone kindly give me some direction on how to go about getting the debugger to work? When I try to do "Debug As PHP Script" within Eclipse, it says "The current debugger does not have any defined PHP executables. Please define a PHP executable location before continuing." but I'm not even sure what this executable is about...


Much appreciated!


Link to post
Share on other sites

Ok, so I figured out that the executable they mean is the php.exe so I pointed that field to where this binary exist. Still, I am not getting past that point, because now I see the message "The debug session could not be started. Please make sure that the debugger is properly configured as php.ini directive."


Not sure what to do next but I found an article that says even this all-in-1 package does not include the Zend debugger, so through Eclipse, I tried installing Zend Debugger from their site. This failed on me as well and gave me an error with all kind of unsatisfactory dependencies.


What should I do next? I can't believe I spent 5 hours trying to get a debugger working...  :(

Link to post
Share on other sites

Just out of trial and error, I tried XDebug instead and that one worked! Now I can do the typical debug stuff on this. Yeah.  :D


What is the difference between Zend and XDebug? Why would one choose to use one over the other?


Link to post
Share on other sites
What should I do next? I can't believe I spent 5 hours trying to get a debugger working...  :(


I did the same thing a while ago, but I was lucky, It was only like 4 hours for me ;)


Anyway, this is how I got it to work, hopefully it helps some people:


1. Downloaded Eclipse for PHP Developers here (fourth one down, the windows 32 bit version) and installed it (just unzip it and put it somewhere)

2. Downloaded xdebug here. The php version, VC version, threadsafe/non-threadsafe, and 32/64bit all need to match your php installation. (use phpinfo() if your not sure, they're all their)

3. Copy the xdebug dll you just downloaded into a folder

4. Add this to your php.ini file (replace zend_extension with zend_extension_ts if your php verision is less than 5.3, and make sure to use the full path to the dll)







5. Now in Eclipse go to Window->Preferences

6. Click the + beside php, then the + debug

7. Where it says Php Debugger, change it from Zend to XDebug

8. Click Php Executables, then Add and add your PHP executable


The only other thing is that for it to work your eclipse workspace has to be inside your servers document root. (For me that was inside the www folder)


Good luck with it, and sorry if I missed a step.

Link to post
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.