Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Derick Rethans:
15 years of Xdebug
May 10, 2017 @ 10:27:14

In a recent post the fifteenth anniversary of the XDebug PHP debugging tool was celebrated and lead developer Derick Rethans was presented with several tokens of appreciation from the PHP community. In this new post to his site he shares the experience (it was a surprise after all) from his perspective and thanks those involved.

This article was going to be about some upcoming features in the 2.6 release. Or rather, I was hoping to announce at least a beta release of Xdebug 2.6. Unfortunately, I couldn't find enough time to work on all the issues that I wanted, although I've made a little progress.

What I can write about, is a little mystery.

He talks about the initial invite from James Titcumb to meet him at his favorite whisky store and the eight special bottles that the community purchased to show their appreciation for his hard fifteen years of work on this invaluable tool. He lists out the types for those interested and some of the messages from contributors showing their appreciation. He thanks all of those involved.

And on the Xdebug front, there are plenty of bugs to fix, features to add for Xdebug 2.6, and undoubtedly Dmitry will be "breaking" some things in PHP 7.2 that I need to support in Xdebug as well.
tagged: fifteen years anniversary derickrethans xdebug debugging tool project whiskey

Link: https://derickrethans.nl/xdebug-15.html

Cal Evans:
Thank you Derick Rethans for 15 years of XDebug
Apr 27, 2017 @ 09:38:58

Recently the Xdebug PHP debugging tool turned 15 and PHP community member Cal Evans wanted to do something special for the author, Derick Rethans. He started a secret fundraiser to gather contributions from all around the community and used the funds to purchase Derick several bottles of his favorite beverage. In this new post to his site Cal shares some about XDebug, Derick and a video of James Titcumb presenting Derick with his present.

There are a handful of tools that have actually changed how many of us code PHP. XDebug is one of those tools[1]. There is no doubt of the impact that XDebug has has on PHP developers and PHP projects.

Recently, XDebug turned 15. This means that the man responsible for XDebug, Derick Rethans, has been supporting XDebug for 15 years, for free. [...] So on this the (close to) anniversary of this product, many of us in the PHP community decided to do something to show Derick how much we appreciate it. Those that know him know that Derick loves a good Scotch. So we decided to buy him some.

Cal has the video embedded in the post (or here on YouTube) and offers thanks to the people and groups that helped to make the project successful.

tagged: celebrate xdebug fifteen years derickrethans gift donation

Link: https://blog.calevans.com/2017/04/26/thank-derick-rethans-15-years-xdebug/

SitePoint PHP Blog:
Getting to Know and Love Xdebug
Apr 20, 2017 @ 17:55:59

On the SitePoint PHP blog editor Bruno Skvorc has posted a tutorial introducing you to Xdebug, the powerful debugging tool for PHP applications.

It’s been 15 years since Xdebug first came out. We think this is the perfect opportunity to re-introduce it to the world, and explain how and why it does what it does. Xdebug is a PHP extension (meaning it needs to be compiled and installed into a PHP installation) which provides the developer with some features for debugging.

It starts off by explaining some of the functionality that Xdebug brings to your debugging practices and the features that can help make it flow a little easier. It talks about how it differs from some of the IDE debugging tools and services like Blackfire.io. Next up is the example putting it to use and what the resulting errors look like. The post then gets into the integration of Vagrant with PhpStorm, using the profiler and how to force the rendering in Laravel output (it normally overrides the exception output with its own formatting).

tagged: tutorial know love xdebug introduction php debug debugging

Link: https://www.sitepoint.com/getting-know-love-xdebug/

Hackermoon.com:
Debugging a PHP application with strace
Mar 28, 2017 @ 11:24:43

On the Hackernoon.com site there's a recent post from Paolo Agostinetto showing you how to debug your PHP application with a different tool that most might use: strace.

Every once in a while it happens that you have a tricky bug, and when it does you risk to lose hours or even days fixing it.

[...] Yet, sometimes there is that one bug that makes you lose your shit after a whole afternoon spent looking for the root cause. In my experience, bugs that I introduce are generally very quick and easy to spot and fix. But the real challenge is finding bugs in other people’s code like third party libraries, PHP extensions or even PHP itself.

He then talks about a time when his situation was a bit different - he was getting 500 errors from his code that weren't being caught correctly by error handling. He found that Apache was out-of-memory-ing but debugging the exact cause (a suspect Doctrine query) would take more time. Instead he turned to strace and, with a bit of hunting in the resulting output, he tracked the issue down to XDebug being enabled (and a setting that was generating a memory leak).

tagged: debug application strace memory error xdebug process

Link: https://hackernoon.com/debugging-a-php-application-with-strace-4d0ae59f880b

Delicious Brains Blog:
Debugging JavaScript and PHP at the same time with PhpStorm
Feb 16, 2017 @ 11:14:20

The Delicious Brains site has a tutorial posted from author Peter Tasker showing you how to debug Javascript and PHP at the same time directly in your PHPStorm IDE.

Since I started with Delicious Brains last July, I’ve become a big fan of PhpStorm. It really is the bee’s knees. I won’t go over the full list of features, but some of the things I find helpful daily are: Cmd+clicking into method definitions, VCS integration and color highlighting of code changes, code bookmarks, and of course, Xdebug integration

In this post I want to expand on what Iain already covered with PhpStorm and Xdebug and show you how to level up your JavaScript debugging skills with PhpStorm.

The tutorial starts with a section explaining why using the PHPStorm debugger could be more beneficial and provide a more integrated workflow. It then starts in on the setup, showing how to set up the extension for Chrome so that it can talk to the IDE for the Javascript side complete with screenshots (and screencasts). With the two integrated the next step is to add a breakpoint in the code and what the results look like when it's executed and thrown.

The post finishes up covering the integration of the debugger with Xdebug allowing for the complete debugging of your application in one place.

tagged: debug javascript phpstorm integration tutorial xdebug

Link: https://deliciousbrains.com/debugging-php-javascript-phpstorm/

James Cowie:
All hail Xdebug and lets let var dump die
Jan 12, 2017 @ 12:58:23

In a recent post to his site James Cowie sings the praises of Xdebug for debugging and says that "var_dump must die" as a method for debugging in your application development flow.

How many times have you been working in Magento or any other php application and hit an error, exception or something not quite right? For me a lot. I’ve been that developer that debugs by fire and throws echo var_dumps and dies around like a western gunslinger. It’s easy, provides quick feedback cycles but lets be honest its lazy, in efficient, rarely provides all of the data you need to solve the problem on the first try and its not something you want to boast about by the coffee machine.

[...] So whats the “better” way of debugging a application? Well welcome Xdebug + PHPStorm. Imagine inside of the IDE we can set a breakpoint, a fancy die and reload our web page. Magically the IDE has stopped execution and we can see the state of the application at that exact path. We can see the variables and we can step through the code and see exactly what class and method is called next and so on and so forth.

While his instructions are specific to PHPStorm, most major IDEs will have a similar setup process with their own tweaks. In his case, though, he has one more layer of complexity - the PHP is executing inside a Docker container. He walks you through the process he followed to get the flow from container to local IDE set up. He wraps up the post with an example of debugging a script and what the results look like inside of PHPStorm (including a screencast).

tagged: xdebug vardump phpstorm docker container tutorial

Link: http://jamescowie.me/blog/2016/12/all-hail-xdebug-and-lets-let-var-dump-die/

Derick Rethans:
Good Bye PHP 5
Jan 11, 2017 @ 10:13:53

On his site Derick Rethans has posted an announcement about a major change in the Xdebug project (a widely used PHP debugger) he leads, saying goodby to PHP 5.

A few days ago I merged a patch into on GitHub. Maintaining PHP 5 and PHP 7 support in one code base is not particularly easy, and even more complicated for something like Xdebug, with its deep interactions with PHP's internals.

As PHP 5.6's active support has ended on December 31st, I also felt it no longer needed to support PHP 5 with Xdebug any more. It saves more than 5000 lines of code.

He shares some of the responses to the change (via Tweets) from the community ranging from full support to outcry over the change. He points out that the current version of Xdebug (2.5) will continue to operate on PHP 5 systems but when Xdebug 2.6 rolls around, the 2.5 branch will only receive bugfixes and no new features. You can find out about those upcoming features here.

tagged: xdebug debugging tool php7 php5 upgrade support

Link: https://derickrethans.nl/xdebug-php5.html

Zend Developer Zone:
A Reverse Debugger for PHP…wait…WHAT?
Nov 16, 2016 @ 11:51:28

On the Zend Developer Zone they have a post talking about an interesting project - a reverse debugger for PHP making it simpler to step forward and backwards through breakpoints in your PHP code (instead of just forward).

Honestly, when I originally tweeted this out I really wasn’t 100% sure what it did. You never know when you see things like “reverse debugger”. It’s one of those “I understand the words separately…” type of things. Then I watched the short video. HO-LY CRAP! Seriously, it is exactly what it says, it allows you to step debug forward AND backwards. Well, almost. You have to record the session first and then you can step forwards and backwards. Still it is a powerful tool.

The project, Don'tBug, hooks directly into any IDE that supports XDebug (just about all of them) making it easy to integrate into your current workflow. You can see it in action in this video over on YouTube.

tagged: reverse debugger language tool dontbug project xdebug

Link: https://devzone.zend.com/7400/reverse-debugger-php-wait/

Adam Culp:
Setting up step debugging in Zend Studio
Apr 11, 2016 @ 11:52:43

Adam Culp has posted a guide on his site showing you how to set up debugging in Zend Studio, the PHP IDE from Zend. In it he walks you through the setup on both the server and client side to get them working happily together.

Recently I was helping someone set up step debugging in Zend Studio, and had some difficulties. Therefore I decided to create a blog post to remind me later, and perhaps help others get it set up.

I was doing this on an Ubuntu laptop, so while menus may vary slightly the process should be very similar. Also, I did this using a local virtual machine in VirtualBox, but using Bridged networking mode to simulate a remote server. In Zend Studio I had a project created with the Zend Framework Skeleton Application, and created a virtualhost in the virtual environment that mirrored that.

He starts with the server, pointing out that the only thing really needed there is an installed and working version of Xdebug. He then goes through each step in the IDE, complete with screenshots:

  • Configuring the server in the Preferences
  • Testing the connection between the two
  • Enabling debugging on the project
  • Ensuring the server is configured correctly to use debugging when specified

While some of his instructions are more specific to a Zend Server installation, they can still be mostly applied to any kind of system. You can also check the Xdebug documentation for additional help.

tagged: debugging zendstudio guide zendserver configuration testing xdebug

Link: http://www.geekyboy.com/archives/1220

Andreas Gohr:
Visualizing XDebug Traces
Feb 29, 2016 @ 12:49:44

Andreas Gohr has posted an interesting article to his site showing you how you can easily visualize XDebug stack traces and make them a bit more clear than the usual output dump.

As alluded to in yesterday's post, I'm currently hunting an elusive bug with xdebug. The problem is, that it only happens sporadically and when I know it happened it is too late to set a break point. So usual debugging methods don't work. Instead I want to use xdebug's execution tracing: let it log all function calls and then pick through the log when the bug occurs.

[...] To ease my debugging I looked for tools that could read the computer readable format. I found a few promising candidates, but in the end they either didn't work or they did not provide what I needed. So instead of hunting the bug, I built a tool

His tool takes in the XDebug output and turns it into something much more readable and properly nested.

tagged: tool library nested output trace stack debugging xdebug

Link: http://www.splitbrain.org/blog/2016-02/27-visualizing_xdebug_traces