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 you 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
copy the following lines into php.ini (they can go at the end of the file). For linux it is a php_dbg.so instead of php.dbg.dll.
[debugger] extension=php_dbg.dll debugger.enabled=on debugger.profiler_enabled=on debugger.hosts_allow=localhost debugger.hosts_deny=ALL debugger.ports=7869, 10000/16
Disable eAccelerator if it is installed and enabled:
Disable the Xdebug extension if installed (usually via pear) by commenting out
Also if you have Zend Extension Manager installed (You should find a [Zend] section) make sure you add this line before any other zend_extension_ts (windows) or zend_extension (linux) lines: For Windows:
zend_extension_ts = "C:\path\to\php_dbg.dll"
Restart web server Get the php.ini path
184.108.40.206. Test the DBG Installation
When you have done all steps, restart your web server and again submit the phpinfo function as described in Section 220.127.116.11, “Find the extension directory”. Search the browser output for “dbg” and you should find a section like you can see in Figure 1.11, “phpinfo showing the DBG section” phpinfo showing the DBG section
Figure 1.11. phpinfo showing the DBG section
In addition you can submit the following URL within your browser: http://localhost/index.php?DBGSESSID=1@localhost:10001. Now, as there is no client running listening to dbg, you should see the following error message DBG Error Message
Figure 1.12. DBG Error Message [Note] Note
For setting up a debug configuration and doing real debugging with PHPeclipse, see Section 4.1, “PHP Source Level Debugging