News Feed

News Archive
feed this:

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

Stephan Hochdörfer:
Configuring Xdebug and phpstorm for CLI debugging
February 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.

0 comments voice your opinion now!
configure phpstorm debugging tutorial localhost server


SitePoint PHP Blog:
Interactive PHP Debugging with PsySH
September 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.

0 comments voice your opinion now!
interactive debugging psysh repl unittest commandline web


Dutch Web Alliance:
The definitive remote debug and unittest with PHPStorm guide part 7
January 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.

0 comments voice your opinion now!
debugging unittest remote phpstorm tutorial series part6


Dutch Web Alliance:
The definitive remote debug and unittest with PHPStorm guide part 3
December 11, 2013 @ 09:19:23

The Dutch Web Alliance has posted the latest part in their "remote debugging with PHPStorm" series (parts one & two are linked here) with part three. This time they focus on setting up Xdebug and configuring the connection in the IDE.

Let's start with probably the most important part of all: debugging your web applications. In this day and age, people still use var_dump() and die() to debug their application. A shame really, knowing that step-debugging through your code is made really easy with PHPStorm. Using var_dump() is very slow, error prone and you only get a small fraction of the context you need in order to debug correctly. And how many times did such a var_dump() hit your production environment?? Truth be told, implementing XDebug does need a little bit of work, but fortunately PHPStorm has made things super easy for us.

They don't go through the whole installation part of Xdebug - there's other guides for that - but do help you configure it correctly to work with a remote debugger in PHPStorm. They show you how to set various breakpoints and a "trick" to working with path mappings.

0 comments voice your opinion now!
phpstorm remote debugging unittest tutorial series part3


Dutch Web Alliance:
The definitive remote debug and unittest with PHPStorm guide
December 06, 2013 @ 11:48:38

On the Dutch Web Alliance site today they've kicked off a new series of posts looking to help you get the most out of the PHPStorm IDE for remote PHP debugging and unit testing your application.

PHPStorm is probably the best IDE when it comes to PHP development. [...] This multi-part guide will try and set up your systems in such a way that EVERYTHING you need to do when it comes to development gets explained so you can set your system up correctly, once and for all. Meet the "definitive remote debugging and unittest with PHPStorm guide". Even though PHPStorm always had many different ways of editing, syncing and deploying your scripts, it was not until PHPStorm 7 that we finally have an IDE that can work fully on a virtualized remote system. In the next couple of blog posts I will try and give you a tour on how to set up your systems so they actually work.

So far they've posted the first two parts of the series:

Keep tuned in to this post (or their feed) for updates to the series and new articles as they're posted.

0 comments voice your opinion now!
remote debugging unittest phpunit phpstorm guide series

Xdebug - Professional PHP Debugging
August 29, 2013 @ 09:56:01

On there's a new article introducing Xdebug, a powerful tool that can help you with debugging your PHP applications. It works by investigating what's happening "on the inside" and reporting it back to your debugger.

Well, technically, Xdebug is an extension for PHP to make your life easier while debugging your code. [...] But just imagine for a moment, as your applications evolve, you might get into the habit of sprinkling your code all over with little echos, var_dumps and custom debuggers. [...] The next question is: how do you debug in production? [...] Now lastly, have you ever wished to be able to step through your code, line by line, watch expressions, and even step into a function call to see why it's producing the wrong return value? Well, you should definitely dig into the world of professional debugging with Xdebug, as it can solve all of the problems above.

They walk you through the setup of a complete (MAMP-based) environment on an OSX installation. You'll also need Xcode and the command line tools to be able to compile Xdebug. They recommend installing Homebrew to make installing the needed tools easier. They use Homebrew to install the PHP 5.4 version of Xdebug which then compiles and outputs a shared module you can put in your PHP extensions directory.

On the other side of things, the article also helps you set up your IDE, in this case PHPStorm but it would work for lots of others - to accept the debug messages from the server. He includes a sample script with some calls to the Xdebug-enabled debugging functions and what kind of responses (with screenshots) you should see in your IDE.

0 comments voice your opinion now!
xdebug debugging extension homebrew mamp osx install tutorial


Enrise Blog:
Debugging Your Web Application with TCPDump and Wireshark
December 14, 2012 @ 12:50:15

On the Enrise blog Tim de Pater has posted about a different sort of method for debugging your web applications - using a combination of Wireshark and tcpdump to monitor your application's input and output.

Everything is running great, until suddenly the monitoring is yelling, the load on several servers is rising, MySQL queries/second and the memcached commands/second going through the roof, Apache processes are higher than usual, and the website starts giving timeouts. Yes, that sucks. Of course you'll first check everything that comes up in your mind like logs, diskspace, swap, etc. But then you come to a point that you really have to dive into it to find the cause of this sudden problem. There are several ways of doing this. One way I learned the last time we were in this scenario is using tcpdump and Wireshark.

He gives you a brief "getting started" tutorial helping you get things set up - dumping the packets with tcpdump and sifting through the results with Wireshark. His examples are more specific to watching for memcache traffic, but it can easily be applied to more general kinds of requests. Screenshots are also included so you can be sure you're seeing the right kind of results.

0 comments voice your opinion now!
tcpdump wireshark debugging memcache application

Silver Lining Blog:
How to Enable XDebug in Windows Azure Web Sites
September 27, 2012 @ 11:53:50

On the Silver Lining blog (a MSDN Windows Azure related site), there's a recent post showing how you can enable XDebug on your Azure instance to help with debugging your application.

In this post, I'll cover how to run XDebug (including the profiler) in Windows Azure Web Sites. Enabling XDebug in Windows Azure Web Sites is as simple as enabling an extension. However, enabling an extension for the built-in PHP runtime is slightly different than doing so for a custom PHP runtime. I'll cover both scenarios here.

The post is broken up into two sections - one if you're just using the built-in PHP runtime that's already in the instance and another if you're using a custom one of your own. Changes to the configuration files and some screenshots of where to make the updates are included.

0 comments voice your opinion now!
xdebug enable windows azure tutorial debugging

Danne Lundqvist:
Using Xdebug in MAMP
September 18, 2012 @ 10:10:01

Danne Lundqvist has a new post today showing you how to install and use XDebug with MAMP, the popular all-in-one LAMP package for OS X.

MAMP is a full local server environment including Apache, PHP and MySQL in one package. Anyone feeling at home in *nix systems should feel at home using both OS X and MAMP. [...] As I have helped a few collegues setup Xdebug in MAMP I have discovered that a lot of developers don't do this as they don't know how simple it is. Even seasoned PHP developers use the old echo/die debugging techniques.

He includes all the changes you'll need to make to configuration files and makes a simple script you can use to test out that things are working. As his IDE of choice is PHPStorm, he shows how to set up the remote debugging to work and reply back as the script is executed.

0 comments voice your opinion now!
xdebug mamp tutorial install phpstorm debugging

Juan Treminio's Blog:
Xdebug and You Why You Should be Using a Real Debugger
July 05, 2012 @ 08:52:13

If you've been working with PHP for any length of time, you know that one of the issues the language has shows up when you're trying to debug your applications. Thankfully, as Juan Treminio points out, there's a better way - Xdebug.

Xdebug is a PHP extension that was written and is maintained by Derick Rethans. It provides debugging and profiling capabilities, although I'll be mostly focusing on the debugging aspects in this tutorial. With it you can set a breakpoint and pause the execution of a script to see the state of your application at that exact point, including what variables/objects have been instantiated and what their values are. Xdebug completely replaces the need to litter your code with echo, print_r() or var_dump() calls, and displays information on all variables, not just the one you passed.

He talks some about the current state of IDE/editor support for the tool and shows how to get it installed and your php.ini configured to use it. XDebug make it easy to turn on/off debugging thanks to a handy browser-based switch. He links to a bookmarklet you can use to make it a one-click operation. He includes the setup for using the debugging in PHPStorm, but it's pretty similar for most of the IDEs out there.

0 comments voice your opinion now!
xdebug debugging install configure ide bookmarklet

Community Events

Don't see your event here?
Let us know!

framework community interview release library extension introduction opinion unittest development podcast api wordpress feature laravel voicesoftheelephpant language laravel5 series threedevsandamaybe

All content copyright, 2015 :: - Powered by the Solar PHP Framework