As a software developer, you come to realise that most code in the world is not written by you. You also quickly learn that it’s generally faster to write new code, than to fix old code. Combine those two snippets of binary wisdom and you have the conclusion that most of your time working on software will be spent fixing other people’s code. Ouch!
Efficient debugging is the best remedy for this painful realisation, and the greatest comfort we’re likely to find. Strangely, the power and popularity of debugging techniques nearly always lags behind the new features and improvements made to mainstream languages. But behold – PHP developers are on the cusp of a major breakthrough! A brand new debugging engine, complete with a slew of new features could be about to revolutionise your workflow. Say hello to phpdbg.
If you’re familiar with xdebug, the heavyweight GDB-esque PHP extension (aka: “the hard to install PHP debugger”), then the core features of phpdbg will be familiar: stepping through code, flexible breakpoints, all sorts of code inspection and disassembly. But don’t run away! Unlike xdebug, you don’t have to compile phpdbg yourself and use Netbeans on top of Ubuntu to get it running.
The best part of phpdbg is that it’s going to be part of the next version of PHP, 5.6, so installing it will be as easy as “sudo yum install php-dbg”. Thank heavens! For those too impatient for the upcoming release, or want a sneak preview of how it’ll work, try this in a terminal on Fedora 20:
cd ~/Downloads # Move to your downloads folder to save the temporary package wget http://rpms.famillecollet.com/remi-release-20.rpm # Download the rpm package containing the new PHP repository data yum install -y remi-release-20.rpm # Install the RPM which contains remi's new repositories sudo nano /etc/yum.repos.d/remi.repo
Set “enabled=1” in the following two sections:
sudo yum clean headers # Delete old package info, forcing an update of remis package list sudo yum update php # Update PHP to version 5.6 sudo yum install php-dbg # Install the new phpdbg module sudo service httpd restart # Restart apache to apply your changes
That’s it – you should now have a running version of PHP 5.6 and phpdbg, ready to test. Good luck!
So, what do you think ?