Home > PHP, WAMP > PHP Debug with Zend Debugger And Eclipse PDT Tutorial Part 1

PHP Debug with Zend Debugger And Eclipse PDT Tutorial Part 1

This tutorial shows how to setup a Zend debugger to work with Eclipse PDT to develop your PHP web program. We split the tutorial into two parts, part one shows how to setup the PDT with Zend Debugger, part two shows how to config the PDT and start debugging. You can check part two here.

If you are still using the “echo <pre> . print_r($val, true) . </pre>” or “var_dump($val)” to debug your PHP web program? This is absolutely a must read for you!

Eclipse is a well developed IDE for programming, the PHP Development Tools Project focuses on the development of complex PHP-driven web applications. However the PDT does not ship with the Zend debugger and setting up a working PHP debug enviroment is not quite well documented if you want to set two tools seperately. Fortunately Zend provides a all-in-one package for her Zend Debugger with the PDT. Thanks God I can make it works for me now.

Before I successfully setup my PDT, I really try to debug my program in the print_r and var_dump ways. Which really make me crazy. However when I make the PDT + Zend debugger working together, the development process is greatly improved.

In this tutorial, we need to download the All-in-One Eclipse PDT + Zend Debugger Package from Zend. And That’s all. So Let’s start.

We are going to set it up with the XAMPP, If you don’t have a good PHP development environment, you should see our Web Development on Windows using Apache + MySQL + PHP Tutorial.

The PDT package should be around 116M, so just unzip the package to “C:\xampp” after you download it. Your Eclipse executable can be found in “C:\xampp\eclipse

To make the PHP load our Zend Debugger, we need to tell PHP where is our Zend debugger extension, the very simple step to so is to copy the ZendDebugger.dll to the PHP extension directory and enable it.

To do this, we open the PHP configuration file which is “C:\xampp\php\php.ini” in XAMPP 1.7.1. For older version, it is “C:\xampp\apache\bin\php.ini

Go to the [Zend] section around line 1262.

Enable the Zend debugger by adding

zend_extension_ts=”C:\xampp\php\ext\ZendDebugger.dll”
zend_debugger.allow_hosts=127.0.0.1
zend_debugger.expose_remotely=always

comment out the other zend options under the [Zend] section like this.

;zend_extension_ts = “C:\xampp\php\zendOptimizer\lib\ZendExtensionManager.dll”
;zend_extension_manager.optimizer_ts = “C:\xampp\php\zendOptimizer\lib\Optimizer”
;zend_optimizer.enable_loader = 0
;zend_optimizer.optimization_level=15

One final step is to copy the ZendDebugger.dll to the php extension directory “C:\xampp\php\ext“.

If you look into the plugins directory of eclipse “C:\xampp\eclipse\plugins“, you should see two plugins from Zend.

The Zend debugger PHP extension is stored in
C:\xampp\eclipse\plugins\org.zend.php.debug.debugger.win32.x86_5.2.15.v20081217\resources\php5

So copy “C:\xampp\eclipse\plugins\org.zend.php.debug.debugger.win32.x86_5.2.15.v20081217\resources\php5\ZendDebugger.dll” to “C:\xampp\php\ext

if you check your phpinfo, you can see the Zend Debugger is loaded.

localhost_phpinfo_php_02Well, we can procede to part two to start debugging here.

http://www.websurfrecorder.com/php-debug-with-zend-debugger-and-eclipse-pdt-tutorial-part-2.html

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • Reddit
  • TwitThis

Author: jarvis Categories: PHP, WAMP Tags: , , , , ,
  1. No comments yet.
  1. No trackbacks yet.