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

PHP Roundtable:
034: Debugging is more than var_dump()
Nov 17, 2015 @ 11:09:48

The PHP Roundtable podcast, with host and PHP community member Sammy Kaye Powers, has posted their latest episode with a look at why "Debugging is more than var_dump()". In this episode Sammy is joined by Derick Rethans (of Xdebug fame), Colin O'Dell and Gary Hockin.

Believe it or not, there's a lot more to debugging your PHP code than var_dump()'ing all the things. We discuss how to use debugging tools to help us comprehensively debug our codebase.

You can watch the playback of the live recording of the episode either using the in-page video player or directly on YouTube. If you enjoy the episode be sure to subscribe to their feed and follow them on Twitter to get information about new episodes as they're released and when future live recordings are happening.

tagged: phproundtable ep34 debugging vardump tools podcast

Link: https://www.phproundtable.com/episode/debugging-is-more-than-var-dump

SitePoint PHP Blog:
Debugging WordPress on Azure with Z-Ray
Oct 13, 2015 @ 11:23:55

On the SitePoint PHP blog there's a tutorial showing you how to integrate the Z-Ray tool into WordPress to make debugging it on an Azure instance simpler. The steps make major use of the Azure control panel handling, so it's not quite as useful as a cross-platform guide but at least it gives you an idea of what you could expect from the Z-Ray+WordPress integration.

We all know that WordPress is an amazingly rich, extendable and simple platform. That’s probably one of the reasons it powers so much of the web today. But in some cases this richness can be the downfall of your site. [...] This means you need an easy, safe and reliable way to profile your WordPress app that will help you identify the bottlenecks slowing it down.

This article demonstrates a simple way to do just this. It describes how to debug a WordPress application deployed on Microsoft Azure’s web app service, using Z-Ray for Azure – a new technology that was announced a few months ago and is now in preview mode.

He walks you through the entire process (assuming you already have an account on Azure:

  • Creating the sample WordPress application on Azure
  • Enabling Z-Ray
  • Developing WordPress with Z-Ray

In that last step he includes some screenshots of the kinds of results you can expect from the plugin including details about cache objects, plugin statistics, hooks being executed and WP Query use. He ends the post looking at using Z-Ray for mobile debugging and how to use it in "secured mode" in a production environment.

tagged: tutorial wordpress azure microsoft zray debugging installation configuration

Link: http://www.sitepoint.com/debugging-wordpress-on-azure-with-z-ray/

#DC4D Brings You Debugging Beyond The var_dump() Approach
Sep 15, 2015 @ 09:52:34

The 7PHP.com site has posted another in its series of spotlights on people and happenings in the PHP community. In this latest edition he talks with Cal Evans about the latest Day Camp 4 Developers evening happening Friday, September 18th: "Debugging Beyond var_dump()".

Day Camp 4 Developers is a virtual ‘mini’ PHP conference. Meaning you can watch in realtime 5 awesome speakers, talking about some cool quality stuffs, while you are comfortably seated on your sofa with your snacks and beverages. [...] It’s a new week on our PHP Calendar, specially in our Virtual PHP calendar – it’s THE week for DC4D which will be held on this upcoming Friday 18th Sept 2015 – see it all here, click! One very important thing to know, DC4D is heartily brought forward by our PHP Icon – the one and only Mr Cal Evans, together with his wife, The Lovely & Talented Kathy.

Cal answers questions about the event including:

  • How it all started
  • How he finds the speakers for the theme for each event
  • Some of the things he's learned from putting on the event

The interview also includes a bonus Q&A with one of the speakers, Joshua Thijssen. They talk about Joshua's motivation behind the talk, one things that people will learn from it and what he sees as the benefit of a live presentation vs recorded.

tagged: daycamp4developers 7php interview calevans joshuathijssen vardump debugging

Link: http://7php.com/dc4d-debugging/

Community News:
Day Camp 4 Developers - Debugging Beyond var_dump()
Jul 14, 2015 @ 08:50:14

The Day Camp 4 Developers online "conference" has officially announced their latest event, "Debugging Beyond var_dump()", happening Friday September 18th from 9am through 3pm (CST). This time around they're putting it on with the help of the fine folks at php[architect] too.

This latest edition of the excellent event features several well known speakers talking about debugging tips and sharing tools that can make you a more effective developer:

  • "PHP Profiling, an Introduction" (Fabien Potencier)
  • "Debugging: Past, Present and Future" (Derick Rethans)
  • "Characterization Testing for Legacy Applications" (Paul M. Jones)
  • "Modern Tools for API Debugging and Testing" (Neil Mansilla)
  • "Don't Reboot, Debug!" (Joshua Thijssen)

Much like it's siblings, the Day Camp 4 Developers event is completely virtual and is held via a webcast. Tickets will soon be sale and, compared to the usual cost of a conference ticket, are quite cheap. There's even group tickets available if you'd like to hold a "watch party" in your office.

Check out the Day Camp 4 Developers site for more information or to pick up your tickets!

tagged: daycamp4developer debugging vardump fabienpotencier derickrethans pauljones neilmansalla joshuathijssen

Link: http://daycamp4developers.com/

Gary Hockin:
Debugging PHP Command Line (with PHPStorm and XDebug)
May 07, 2015 @ 11:47:09

Gary Hockin has a recent post showing how you can debug PHP HTTP requests from the command line using PHPStorm and XDebug. These instructions aren't specific to PHPStorm, however. They can be used in any IDE/editor that supports remote XDebug connections.

At PHP North West I had huge difficulties configuring Xdebug and both my PHP and PHP Storm so they play nice in a CLI environment. So here, for others and almost certainly my future self, is how to do it.

He goes through each step of the setup process assuming that you already have the necessary software installed. He shows how to configure XDebug for remote debugging in the ini configuration, setting up PHPStorm to receive the connection and, finally, adding the "XDEBUG_CONFIG" environment variable to tell PHP to relay the requests back to your waiting IDE.

tagged: remote debugging phpstorm commandline xdebug configure setup environment

Link: http://blog.hock.in/2015/05/04/debugging-php-command-line-with-php-storm/

Derick Rethans:
Xdebug 2.3: Improvements to Debugging
Mar 25, 2015 @ 09:13:34

In the latest in his series covering some of the improvements in the latest Xdebug release, Derick Rethans has posted this new article detailing some of the performance enhancements related to remote debugging that come with this new version.

This is the fourth article in a series about new features in Xdebug 2.3, which was first released on February 22nd. In this article we are looking at the improvements towards "remote" debugging.

The updates include showing the values of user-defined constants, being able to set an exception breakpoint on all exceptions and additional features around debugging the exceptions themselves. The output now includes the exception's error code and which exception the flow was broken on (though in his example of PHPStorm, the IDE won't report that information back). The last change he mentions is a change that reverts the output to a log if it can't write to a socket (usually SELinux related).

tagged: xdebug performance improvement remote debugging version release

Link: http://derickrethans.nl/xdebug-2.3-debugging-improvements.html

Derick Rethans:
Xdebug 2.3: Munging errors
Mar 10, 2015 @ 09:15:47

Derick Rethans has posted a new part of his series looking at the improvements that came with the latest Xdebug release (v2.3). In this new article he talks about error handling and intercepting them to make debugging simpler.

One of the first features I added to Xdebug was the interception of error messages, so that it was possible for me to include a stack trace. Xdebug 2.3 has a few additional settings to control the behaviour of interception.

He covers the addition of three new settings: xdebug.halt_level, force_display_errors and force_error_reporting. Each of these is designed to provide you with customizable error reporting. Each setting comes with an example of its configuration and how it modifies the output of the resulting errors.

tagged: xdebug error haltlevel force reporting display debugging tool

Link: http://derickrethans.nl/xdebug-2.3-error-munging.html

Stephan Hochdörfer:
Configuring Xdebug and phpstorm for CLI debugging
Feb 11, 2015 @ 11:24:09

Stephan Hochdörfer has a quick post to the bitExpert blog today showing you how to configure Xdebug+PHPStorm for CLI debugging, making it even easier to work with command-line PHP applications.

Current situation: I have no local webserver running and just php5-cli (plus a few extensions) installed as most of the development I do will make use of a Vagrant machine. From time to time I develop small tools or libs which I like to debug on the command line. This is an overview how I configured my Ubuntu 14.04 box to handle debugging with Xdebug and phpstorm.

He starts with helping you get Xdebug installed (via PECL) and configured for local debugging. Next he adds some variables to the .bashrc configuration file with the IDE and Xdebug configuration details. Finally he gives the instructions to get PHPStorm to play nicely with this setup via it's own "Servers" support.

tagged: configure phpstorm debugging tutorial localhost server

Link: https://blog.bitexpert.de/blog/configuring-xdebug-and-phpstorm-for-cli-debugging/

SitePoint PHP Blog:
Interactive PHP Debugging with PsySH
Sep 30, 2014 @ 12:53:30

The SitePoint PHP blog has a new tutorial posted by i>Miguel Ibarra Romero showing how to use the PsySH tool to do some interactive debugging of your PHP applications via both the command line and a web frontend.

It’s 1:00 a.m., the deadline for your web application’s delivery is in 8 hours… and it’s not working. As you try to figure out what’s going on, you fill your code with var_dump() and die() everywhere to see where the bug is. [...] Is this situation familiar to you? PsySH to the rescue. PsySH is a Read-Eval-Print Loop (or REPL). You may have used a REPL before via your browser’s javascript console. If you have, you know that it possesses a lot of power and can be useful while debugging your JS code.

He walks you through the install via Composer and some of the basic commands and syntax for executing PHP code inside its shell. Command line testing is good, but debugging full applications is a bit more difficult. He shows how to integrate the tool into a sample application that calls PsySH via a "debug" call and output via a set of "window" objects. He also includes a bit close to the end about debugging with unit tests, executing them from inside the shell as well.

tagged: interactive debugging psysh repl unittest commandline web

Link: http://www.sitepoint.com/interactive-php-debugging-psysh/

Dutch Web Alliance:
The definitive remote debug and unittest with PHPStorm guide: part 7
Jan 29, 2014 @ 10:54:25

The Dutch Web Alliance has posted the seventh part of their series looking at getting remote debugging and unit testing working with PHPStorm, a popular PHP IDE. You can start at the beginning or just find the links to any other articles in the series you might have missed in the first post.

So, your unit-tests should be small, not doing much, taking one unit at a time to test. Overall, not much is around to actually debug. But on occasion, having the ability to actually stepping through the unit-tests can save you a headache or two! Debugging your PHPUnit scripts isn’t really that hard. In fact, most of what we need to do, we already covered in the previous postings! Consider this: PHPUnit is nothing more than a PHP framework running from the command line interface. And since we already know how to debug applications from the CLI, it must be easy!

This is the last post in the series and is pretty short. It basically talks about setting breakpoints in testing and letting PHPStorm catch the issues. If you'd rather run them from the command line, check out part six for more details.

tagged: debugging unittest remote phpstorm tutorial series part6

Link: https://dutchweballiance.nl/techblog/the-definitive-remote-debug-and-unittest-with-phpstorm-guide-part-7/