Debugging PHP in Quanta Using xdebug

Quanta is a full featured KDE programming editor. Quanta now has support for DBGp debugging protocol. Install quanta by by issuing following command.

sudo apt-get -y install quanta

Configuring xdebug

Install xdebug using previous blog post on Debugging PHP using xdebug. After installing xdebug add following configuration options to your /etc/php5/apache2/php.ini.

xdebug.remote_enable = 1
xdebug.remote_handler = dbgp
xdebug.remote_mode = req
xdebug.remote_port = 9000
xdebug.remote_host = localhost

Now restart your apache using following command.

sudo /etc/init.d/apache2 restart

Configuring quanta

You can debug php scripts only in projects. Create a new project in quanta and add /var/www to it. Open project properties, select DBGp from Debugger combo box and accept remaining default settings. If you followed previous steps and debugging on local machine then you don't have to do anything else. If you have to change debug port and server url then click on Options button and change those settings.

By now you should have a debug menu and debug toolbar. If quanta is ready for debugging then all those debugging buttons on toolbar will be enabled by default. If not then start a new debug session from debug menu in menubar.

From now you can set breakpoints, watch variables and get call stack(backtrace) information during debug session.

3 comments:

edwin said...

Note that if your project isn't hosted under the main /var/www directory, at least for me, Quanta doesn't just figure it out.

I had to go under Project Settings, then choose the debugger "options" button, and put in the path
http://localhost/edwin/smoosh/%rfpp?XDEBUG_SESSION_START=1&XDEBUG_PROFILE

to get it to debug files that are stored under /var/www/htdocs/edwin/smoosh/

It worked fine once that was done.

There's another free source/free $ tool, protoeditor, that gives a slightly richer debug experience - or else I haven't figured out how to use Quanta to get the same effect - in protoeditor, you can see all the PHP superglobals.

Also, it's worth mentioning that hardware requirements are low with these tool combos. I have an 600 MHz pc with 384Meg RAM and performance is fine.

Knight Samar said...

+1 for quanta not being able to figure out the project directory.

Knight Samar said...

+1 for quanta not being able to figure out the project directory.