Using PDT : Installation : Installing the Zend Debugger
Zend Debugger is a full-featured php debugger engine, an interactive tool that helps you debug PHP scripts. It works with a production and/or development web server and allows you to debug your scripts locally or remotely, from an IDE or the console.
To get the debugger to work you need to install the debugger engine to run in the PHP interpreter (server part), and configure the debugger client to communicate with the engine.
If you only want to debug against a web server (either local or remote), you don't need to add anything to your Eclipse PDT. PDT has a built-in, pure Java debugging client that operates the Zend debugging engine. This is true either for PDT all-in-one package or the PDT plugin only
Note: If you want to debug local PHP scripts, either for command line scripts or for single cgi scripts, you may need to install the Zend Executable Debugger plug-in. The Zend Executable Debugger plug-in adds a local PHP 4 and PHP 5 binary ready for debugging. This is useful if you do not have a PHP binary locally or cannot use your local php binary because it is not suitable for debugging (depends on compile options, ...) or want to use this debugger without the PDT (with PHPEclipse, for example).
Installing Zend Debugger client
To install the Zend Executable Debugger plug-in using the Update Manager, follow the instructions I provided earlier to set up a new update site using the following information:
PHP Development Tool (PDT) UPDATE URL: http://downloads.zend.com/pdt
Please note that the Zend Executable Debugger is not available from the Eclipse site’s PHP update URL listed in my earlier post. Instead, you must use the Zend update URL (listed here) to install the debugger. When installing, if you already have the PDT installed, simply choose to install only the Zend Debugger.
Installing Zend Debugger server
Make sure you download the appropriate Zend Debugger binaries for your OS and your release of PHP (from 4.3.x up to 4.4.x and from 5.0.0 up to 5.2.x). Curently it is available for Mac OS X, Linux 32/64bits and Windows 32 bits.
Getting the right Debugger Extension Binaries
Debugger Extension can be downloaded from Zend Downloads. You need to download the Debugger Extension packet for the appropriate operating system. Unpack the zipped packet and take the dll (or so) file which matches the PHP version you have currently running. E.g. for PHP 5.1.2 the correct file is ZendDebugger.so (ZendDebugger.dll for Windows) inside 5_1_x_comp directory. Then read following Section, “Find the extension directory” to find out the right destination location for the file.
Find the extension directory
The best way to find out is via the “phpinfo()” command. Create a PHP-file called phpinfo.php with the following content:
<?php phpinfo(); ?>
and start it via your web browser. Then search for “extension_dir”. The right column shows the path to the directory where you have to place the php_dbg.dll/so (see Figure 1.9, “The information about the extension directory”).
Figure 1.9. The information about the extension directory
Where is the php.ini which needs to be set up?
The simplest way to find out the path of the php.ini is again with the help of the phpinfo function as described in Section “Find the extension directory”
The resulting output shows the path of the php.ini file within the topmost header. See Figure 1.10, “Get the php.ini path”
Figure 1.10. Get the php.ini path
- Now open php.ini and search for “implicit_flush”, and set it to “On”.
; this is to see output while debugging implicit_flush = On
- For Windows, copy the following lines into php.ini (they can go at the end of the file).
[Zend] zend_extension_ts=/full/path/to/ZendDebugger.dll zend_debugger.allow_hosts=<comma separated ip_addresses> zend_debugger.expose_remotely=always
[Zend] zend_extension=/full/path/to/ZendDebugger.so zend_debugger.allow_hosts=<comma separated ip_addresses> zend_debugger.expose_remotely=always
- Disable eAccelerator if it is installed and enabled:
- Disable the Xdebug extension if installed (usually via pear) by commenting out
- Also if you have DBG Debugger installed make sure you comment out this line :
Note: You may have different experiences loading both zend_extension, DBG, eaccelerator or other cache engines changing their order of appearance within php.ini but usually they prevent Apache to properly start.
- Type the IP address of the machine you are running the Eclipse PDT Client in the directive: "zend_debugger.allow_hosts="
Make sure you restart your web server after such change.
- Copy the file named dummy.php in the server's document root directory.
The file is inside the "Debugger Extension" archive. If this file is not there, please download it from:
Place the downloaded file in the web server root directory.
- Finally restart web server
Test Zend Debugger Installation
When you have done all steps, restart your web server and again submit the phpinfo function as described in Section “Find the extension directory”. Search the browser output for “Debugger” and you should find a section like you can see in Figure “phpinfo showing the DBG section”.
Figure. phpinfo showing the Zend Debugger extension
For setting up a debug configuration and doing real debugging with Eclipse PDT, see Section "PHP Source Level Debugging" -> TODO