version 0.9

I’m writing this article to illustrate a “simple” configuration to get a client/server setup for debugging PHP applications with Linux. For the server side, I’m using CentOS or Tao Linux (distributions based on Red Hat Enterprise Linux). For the client side, any distribution with KDE will be great (I’m using PCLinuxOS).

It’s important to understand that setting up a server with the debugging extensions enabled is not for a production environment. I will strongly suggest to use a debug server on private/reserved LAN.

To debug your PHP applications you need these tools:

Installing the debug server (with Apache with PHP support and mysql) usually is simple. Most server distributions will setup this software with the default install. You can follow this great how to on Howto Forge that explain step by step installing CentOS with PHP+Apache (the article is for a 64bit system, but is almost the same for any architecture). The tutorial cover many others applications (like mail sever and DNS server) but for your debug server, you can skip all except Apache/PHP/Mysql (anyway installing also a FTP server – proftpd – it’s a good choice).

Ok, now you should have a working web server: create a file phpinfo.php in /var/www/html/ with this code


then open your web browser and point to the created file ( – assuming that is your debug server IP). You should see the typical phpinfo() output with many useful information. Check your PHP version from the header:

Get the PHP version

Now you can go to DBG website to download pre-compiled dbg modules (the file with the name dbg-2.13.1-glibc-2.2.tar.gz – when I’m writing). Locate into the archive the correct module ( for example) and move into module directory

# mv /usr/lib/php4/

Create and edit the file /etc/php.d/dbg.ini and add these lines:
[debugger] debugger.enabled=on
debugger.ports=7869, 10000/16
debugger.JIT_enabled = on
debugger.JIT_port = 7869
debugger.JIT_host = clienthost

The debugger.hosts_allow directive is used to specify the debugging client IP (you can put many IP here). The last step is to restart the apache server to load the new settings

/etc/init.d/httpd restart

If you have configured correctly your server, browse again your phpinfo.php and search the DBG section.

phpinfo() with DBG enabled

Great! The server side configuration is almost complete. Now is time to install Protoeditor. After installing it, create a new web project with Quanta. It’s not mandatory, but to correctly debug scripts, you must have a local copy of the PHP scripts, so using the Quanta internal web project module, simplify the synchronization tasks between your local copy and the server.
I will not illustrate how to create web projects with Quanta here, anyway is really simple.

After installing protoeditor, run it and go to Settings -> Configure Protoeditor, select Debugger+PHP and configure as the following screenshot…

Protoeditor debugger settings

Go to the Sites entry and add a new site.

Create a new debugging site

Filling the site settings, the URL field is where on remote debug server the PHP script is located. Remote base dir is the system path on the remote debug server. Local base dir is the local path of the PHP script (on the same host where Protoeditor is installed). Default file is the first file open for debug when you select to debug the “sample” project.

For this sample project I have created a simple for loop (the hello.php file):

$count = 10;
for ($i = 1 ; $i < = $count ; $i++) { echo $i; } ?>

Now fire up protoeditor and open the “sample” project, then Script -> Start debug. That’s all, you are running a powerful debugging environment, with step-by-step debugging, Breakpoints, output on browser and many more cool features.

Protoeditor at work

Notes: I have experimented some problems with dbg-2.13.1-glibc-2.2.tar.gz so I have downloaded an older version: dbg-2.11.32-glibc-2.2-php43.tar.gz (here).
With this version all is working fine.
I’m working on a RPM package for PCLinuxOS, when finished I will post the binary package here or into a public contrib mirror.

Leave a Reply

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