Note: This is an article restored from archive. There zero reason not to use an IDE that has good PHP xdebug support at this point. The selection of PHP friendly IDEs at this time was poor.
Sometimes tracking down the source of a particularly frustrating bug can be tedious. Simply running
var_dump() here and there is problematic and not very elegant. Sometimes it’s nice to step through the code line by line and examine the values of variables at the point of execution.
There are several ways to accomplish the above, but on my setup (Mac + VirtualBox), I prefer MacGDBp.
To get it running, first you need to make sure Xdebug is installed. For me, I run Ubuntu in a VM, so
apt-get install php5-xdebug is enough to get me running. Next, you need to configure Xdebug to broadcast the debugging information and flow control over a port that MacGDBp can listen to:
[xdebug] xdebug.remote_enable=1 xdebug.remote_handler=dbgp xdebug.remote_port=9000 xdebug.remote_autostart=1 xdebug.remote_connect_back=1
Note: Even though this is an old article restored from archive, this configuration still holds true for most modern setups.
Now your system has everything you need to listen to the dbgp protocol. After installing MacGDBp, running your php code will automatically stop progress and show up in the debug display. You can configure this to not stop on first launch and instead set breakpoints. Since Xdebug is an extension, you can insert
xdebug_break(); at any point in your code to stop execution and step through using this interface.
With just a small amount of effort, you can have an environment for properly debugging your code easily and effectively.
At Zumba, I implemented CSRF protection to all our state-changing user inputs. With a large and complicated site, implementing CSRF is a very tricky …
It is an unspoken rule that if you utilize something other than Wordpress for a blog that you must include an article on how it is built. This is that …
With Atlassian’s announcement suspending development of Stride and dropping support for Hipchat in favor of Slack, I decided that the time was right …
I’ve heard many co-workers, friends, and colleagues at meetups acknowledge the existence of generators in PHP, but not understand why they would use …