Friday, October 23, 2009

PDT + Zend Debugger debugging

Debug as PHP script:
After installed PDT (using eclipse's update manager, not the all-in-one package) and Zend Server CE, tried to follow the PDT tutorial , section Getting Started->Basic Tutorials ->Working with the Debugger. however it threw me error message as:
“The debug session could not be started.
Please make sure that the debugger is properly configured as a php.ini directive”.

At first, thought it's Zend Server problem, tried to turn on Debugger in Zend Server, and added php.exe in the debug configuration tab in PDT, just wont' work. then thought it's php.ini's problem because no [Debugger] session ever found in php.ini under Zend folder or my local php folder at c:/php/.

Suspected that zend debugger was actually not installed in eclipse, from eclipse goto install new software tab, choose download site as 'http://downloads.zend.com/pdt' to download zend debugger. and tried debug code again, still failed with the same error message.


Googled around with no successful suggestion, got back to read PDT tutorial again, this time read section Tasks->Dubugging Files and Applications->Locally Debugging a PHP Script and found the first line looks interesting:
You must configure your PHP Executable through the PHP Executables Preferences page before you can debug locally.

Ok, went to PHP Excutables Preferences page.now i see what's wrong. went to eclispe, Window->Preferences->PHP->PHPExecutables, on the right side, selected 'PHP 5.2.10(CGI) (Workspace Default) | Zend Debugger | c:\Program Files\eclipse\plugins\org.zend.php.debug.debugger.win32.x86_5.2.26.v20090817....
debugged again, breeze, it worked!

Debug as PHP webpage:
Refer to PDT online tutorial, section 'Getting Started'->working with the Debugger:
Save both files and copy them to your server.

This one is tricky, it requires you to copy your php filed edited in PDT to your local web server doc foler, for apache2 it's htdocs folder, and make sure your apache server is up running. then you can locally debug the PHP web pages in PDT.

So PDT is independent of Zend Server CE or local php/apache settting up, it uses its own php/zend debuger plugin to do its local debugging, which arouse another question: what's the difference between WAMP server and Zend Server?

No comments: