How to install and setup Eclipse for PHP debug

The PHP Development Tools (PDT) plug-in, when installed with Eclipse Europa, gives you that ability to quickly write and debug PHP scripts and pages.PDT supports two debugging tools:

  • XDebug and
  • Zend Debugger

This post contains a brief description (along with links to various tools and S/W used) of how to go about setting up a complete PHP development & debug environment alongside a WAMP (Windows Apache, MySQL, PHP).

What you will need:

Time for action:
  • Install WAMP. Before you dive in, make sure you do not have a previous version of WAMP installed. If IIS or Skype are installed, please stop/close these as they may be using port 80 that WAMP needs!!
    • When ready, double click WAMP installer executable and follow instructions on screen to install. Default install location is C:\wamp.
    • Once installed, an icon in the right hand side of the windows task bar allows managing the WAMP Server.
    • Change default port 80 that Apache listens on, to say 8080 if you have other applications that need to use the port 80. This can be done by editing C:\wamp\bin\apache\Apache2.2.11\conf\httpd.conf file and replacing 80 with 8080 (or any other free port that you can/wish to use). Restart Apache after you have saved the changed httpd.conf file.
  • Install Eclipse – extract the downloaded ZIP file to a location of your choice and you are done. To launch the Eclipse application, double click the eclipse.exe. This file is located in the folder where the ZIP file has been extracted to.
  • Copy the “php_xdebug-2.1.0-5.3-vc6.dll” file (downloaded from xdebug.org) to C:\wamp\bin\php\php5.3.0\ext. Replace “C:\wamp” with the folder path if you installed WAMP in a non-default location. Now edit the C:\wamp\bin\php\php5.3.0\php.ini file and append the following to it.
[Zend]
zend_extension=”/full/path/to/php_xdebug-2.1.0-5.3-vc6.dll”
zend_debugger.allow_hosts=”127.0.0.1, 10.0.1.3″
zend_debugger.expose_remotely=always
You should now be all set to start using Eclipse with Xdebug to help with debugging PHP scripts/web pages.
For a complete and detailed guide on “Debugging PHP using Eclipse and PDT”, please visit http://www.eclipse.org/pdt/articles/debugger/os-php-eclipse-pdt-debug-pdf.pdf
Rating:
53.0
181 votes
1 2 3 4 5

Leave a Reply