Debugging PHP Applications Remotely Like a PRO Using Eclipse, XDebug and SSHFS

How did it even come to a point where I needed this? Well, owning a dedicated Debian box in Frankfurt with some 50 websites that tend to have problems from time to time led me to a painful conclusion that debugging using echo statements is better left for high school lessons. If I was left without my debugging setup today I would probably feel like trying to code an operating system in assembly. createssh

So how does a practical scenario of what you will learn to do look like? Well it goes something like this:


  1. A live site on my server in Frankfurt fails in some mystical manner. vibrantbiz
  2. I am notified of the failure and fire up Eclipse immediately.
  3. I fire up the XDebug extension on the server.
  4. My Eclipse installation already contains prepared projects and debug sessions so I just fire up the appropriate one.
  5. Withing up to two minutes I am stepping through the code of the offended website and usually within a few minutes the bug is squashed.
  6. Turn off the XDebug extension and all is back to normal. recommendit


But don’t be mistaken, this setup is not only for live sites. I absolutely do use it while developing PHP applications. The reason I used this example is to show you the sheer power it possesses in critical and urgent situations when you have that client banging on your door to get his site working.

Instructions featured in this article are Linux oriented for brevity. In order to get the instructions for Windows you will need to check out the original tutorial. A link to the original tutorial is found in the signature.

Installing Eclipse

The first step in our journey is to install Eclipse IDE with PDT (PHP Development Tools). You should be able to fetch the latest version of Eclipse PDT for your operating system at the Eclipse downloads section. The installation procedure on my Debian box was trivial: download, extract and run. The only issue I run into was not being able to run Eclipse with PDT in a stable manner with anything other than Sun JRE. So if you get any weird errors that might be your culprit. frontrunnerz

Installing XDebug

The next thing is adding the debugging ability to your PHP Apache extension. Under Debian box this turned out to be pretty trivial:

# aptitude install php5-xdebug

However, you also need to set some things in php.ini:



xdebug.remote_host=”” getalink



xdebug.remote_log = /tmp/xdebug.log



For more info please visit sites:-



Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *