News Feed
Sections




News Archive
feed this:

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

SitePoint PHP Blog:
How to Install Xdebug with PHPStorm and Vagrant
July 08, 2014 @ 11:32:42

The SitePoint PHP blog has a recent post showing you how to get Xdebug installed and working with PHPStorm through a Vagrant installation. The Xdebug tool provides additional debug information on top of what PHP natively includes in its own error handling.

Xdebug is a PHP extension which allows you to debug and profile your code, view detailed and readable stack traces when errors happen, and much more. For a detailed walkthrough, see Shameer's post. If you're completely unfamiliar with it, you would do well to first install it following the procedures below, and then refer to the post linked above for a breakdown of everything Xdebug can do for you and your apps. In this tutorial, we'll set up Xdebug with PHPStorm for Vagrant hosted PHP apps.

His guide doesn't actually include the installation of Xdebug via Vagrant as the VM he's chosen (Vagrant Homestead) already has it installed. If you need instructions on that, check out this other tutorial. He shows you how to enable it in Homestead and configure the extension to connect back out to your waiting PHPStorm client. He then moves on to the client side and shows how to connect it to the server through PHPStorm's own debugger configuration. He includes a bit of sample code to test the connection (a Laravel route) and checking that the breakpoint handling works as well.

0 comments voice your opinion now!
xdebug phpstorm vagrant homestead install configure

Link: http://www.sitepoint.com/install-xdebug-phpstorm-vagrant/

Derick Rethans:
Dead Code
June 18, 2014 @ 10:49:56

In his latest post Derick Rethans talks about something that plagues every project, PHP or otherwise, after its grown to a large enough size: dead code. He's been asked why his Xdebug tool finds this code in places where people don't expect, so he figured he'd answer it once and for all.

The explanation for this is rather simple. Xdebug checks code coverage by adding hooks into certain opcodes. Opcodes are the building blocks of oparrays. PHP converts each element in your script - main body, method, function - to oparrays when it parses them. The PHP engine then executes those oparrays by running some code for each opcode. Opcodes are generated, but they are not optimised. Which means that it does not remove opcodes that can not be executed.

He gets down to the opcode level and shows some output from vld on how things are being executed (and what's not). Using a simple "foo" function example, he shows the execution flow and how the "branches" of executions work through the code. In his case, the "dead code" marker is coming from the line with a closing brace from an "if" statement. He points out that it entirely depends on the lines executed as to what is marked as "dead code".

0 comments voice your opinion now!
dead code xdebug path flow branch vld

Link: http://derickrethans.nl/dead-code.html

SitePoint PHP Blog:
Debugging with Xdebug and Sublime Text 3
February 28, 2014 @ 11:10:53

The latest post from the SitePoint PHP blog, a new tutorial by Peter Nijssen, shows you how to get started with Xdebug and Sublime Text 3 to debug your PHP applications.

Debugging - we all do it a lot. Writing code perfectly the first time around is hard and only a few (if any) succeed at it. More than a year ago, Shameer wrote an article on SitePoint about how you can debug your application using Xdebug and Netbeans. In this article, we are going to have a look at how we can debug using Xdebug in combination with Sublime Text.

He assumes you already have Xdebug installed (and links to the instructions for those that don't) and helps you configure it to find your listening editor. Back in Sublime, he shows you how to use the package manager to install the Xdebug client and configure the current project to use it. He shows how to set up breakpoints and view the stack/watch data when the point is hit.

0 comments voice your opinion now!
debug xdebug sublimetext remote tutorial package client

Link: http://www.sitepoint.com/debugging-xdebug-sublime-text-3/

Dutch Web Alliance:
The definitive remote debug and unittest with PHPStorm guide part 6
January 09, 2014 @ 11:20:28

The Dutch Web Alliance has posted the sixth part of their series helping you debug/unit test your applications with PHPStorm and Xdebug. In this new post they focus on working with command-line applications.

So there is already a lot covered: debugging web applications, testing your units, getting code coverage. But one thing that remains is trying to debug your command line applications. Even today more and more applications aren't built for primarily the web, but for other purposes or many web frameworks have some kind of "console" component which allows you to easily create command line tools that deals with asynchronous handling of data, or just mere as cronjobs.

They walk you through the steps you'll need to be sure everything it set up correctly for PHPStorm to catch the debug calls:

  • Ensuring Xdebug is active
  • Validating that PHPStorm is listening for incoming requests
  • Configuring Xdebug on where to connect
  • Setting up the mapping for paths inside PHPStorm
0 comments voice your opinion now!
xdebug phpstorm unittest debug tutorial series part6 commandline

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

JetBrains.com:
Just-In-Time debugging and PHP Exception Breakpoints with PhpStorm and Xdebug
December 19, 2013 @ 09:30:59

On the JetBrains site there's a recent post showing you how to use just-in-time debugging and breakpoints in their PHPStorm IDE combined with the popular PHP debugging tool Xdebug.

In every project comes a moment where code stabilizes and we don't want to keep the debugger attached to our code all the time. Or maybe we just want to run our code and only attach the debugger when an error occurs or an exception is thrown. Meet Xdebug's just-in-time (jit) mode and PHP Exception Breakpoints in PhpStorm!

This feature makes use of the "jit" setting for the "remote_mode" setting that Xdebug offers to only send debugging information back to the remote debugger with an error occurs. They show you how to set up PHPStorm for these debugger connections and some example screenshots of it in action. The breakpoints feature compliments this functionality by allowing you to set breakpoints on which kind of errors you want to see information about (ex. warning, notice or deprecated issues).

0 comments voice your opinion now!
phpstorm debug exception xdebug justintime remotemode breakpoint

Link: http://blog.jetbrains.com/phpstorm/2013/12/just-in-time-debugging-and-php-exception-breakpoints-with-phpstorm-and-xdebug/

Derick Rethans:
Contributing Advent 1 Xdebug and hidden properties
December 02, 2013 @ 09:16:50

As a part of his "Advent Contribution" series Derick Rethans has posted about an update to XDebug that fixes a bug reported around hidden properties.

This first contribution is for bug #987: "Hidden property names not shown". In PHP it is possible to convert an array to an object. [...] Xdebug's standard HTML var_dump() as well as the CLI, the coloured CLI and the debugger interface DBGp all suffered from the same issues that numerical properties were not showing in output.

With the committed fix the output of the var_dump now shows these special property names with curly braces around them and makes them available via the property_get method. If you're interested in the actual commit, you can check it out here.

0 comments voice your opinion now!
advent contribute hidden properties xdebug vardump propertyget

Link: http://derickrethans.nl/advent01.html

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

On NetTuts.com 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

Link: http://net.tutsplus.com/tutorials/tools-and-tips/xdebug-professional-php-debugging/

Chris Jones:
Quick Debugging of PHP Scripts in Emacs with Geben and Xdebug
January 24, 2013 @ 11:19:47

Chris Jones has a new post showing how you can use Emacs and Xdebug for debugging with the help of the geben plugin.

When you want to test a PHP code snippet quickly, it's handy to do it within your day-to-day environment. For me, this environment is Emacs. The geben package for Emacs provides an interface to the DBGp protocol, such as used by Derick Rethans's standard Xdebug extension for PHP. With the combination of geben and Xdebug, I can quickly and efficiently step through execution of local files, examining code flow and data values.

He includes a ten step process (step 11 is basically "use it") that walks you through the installation of the full stack - PHP, Xdebug and geben - and the configuration changes you'll need to make to get them all working together. Some basic usage instructions are included, but if you want more details on using geben, check out the project's site.

0 comments voice your opinion now!
emacs xdebug tutorial install debug engen plugin


7PHP.com:
Interview with Derick Rethans - The Father Of The PHP Swiss-Army Knife aka Xdebug
January 14, 2013 @ 09:28:44

On 7PHP.com today Khayrattee Wasseem has posted his latest interview with a member of the PHP community - this time it's Derick Rethans "The Father Of The PHP Swiss-Army Knife aka Xdebug".

In this edition I talked with Derick Rethans the Father Of The PHP developer's Swiss-Army Knife aka Xdebug. Derick is an expert when it comes to the PHP Internals; no wonder he is viewed as a vibrant and "man of action" within The PHP Community. As a PHP Core Contributor, he has been at the crux of many PHP extensions and variations; the mcrypt, date and input-filter extensions, bug fixes, additions and even leading the QA team.

Derick answers questions about how he got involved with PHP and how he thinks it compares from then to now. He also talks some about what tools he uses for his development and more details behind Xdebug's origins and PHP extensions in general.

0 comments voice your opinion now!
interview community derickrethans xdebug


Joshua Thijssen:
Debugging remote CLI with phpstorm
December 24, 2012 @ 10:11:00

Joshua Thijssen has a recent post for all the PHPStorm users out there (or maybe investigating a new IDE) and are looking for a way to debug your PHP apps easily with XDebug. Well, he's come up with a step-by-step guide to help you get it all set up and working, complete with screenshots. He helps you debug command-line applications, but the setup will work for your web apps too.

Even in these days, with full-featured PHP IDEs around, I still see PHP developers using var_dump() and die() to debug their code. Not only is this a very bad way of "debugging", it has other dangers as well [...]. We've probably all been there,.. But we don't have to. Debugging your code properly through an IDE is quite easy, but one of the major problems is debugging CLI code. Since many frameworks like Zend, Symfony and micro-frameworks like Cilex can be used to create command-line apps, cronjobs and even "deamons", so how do we easily debug this kind of code?

He starts with the setup of a development instance (he recommends a clone-able virtual machine environment) and shows how o configure both XDebug and PHPStorm to work together happily. He shows what configuration options and steps you'll need to take to be able to debug the CLI apps too, including a command-line option to specify the IP to report the debugging into back into.

0 comments voice your opinion now!
commandline application debug xdebug phpstorm tutorial screenshots



Community Events





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


list introduction deployment api series release community interview library package install zendserver symfony laravel opinion language update tips podcast framework

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework