How to Install Xdebug for Your PHP Application

Bugs running amok in your PHP application? Xdebug is a free program that helps you debug your PHP application. So you can spend more time coding and less time searching through thousands of lines of code for one little bug. Xdebug is highly powerful and highly performant and allows you to get more detailed information about where your program is failing.

We’ll show you how you can make your development more efficient and more enjoyable by installing and using Xdebug. Here’s the path we’re going to follow:

  • Download Xdebug.
  • Use our PHPInfo page to help install Xdebug.
  • Add Xdebug files to our local development environment.

And that’s just about all we’re going to need to do. Follow along below and let’s get started.

Of course you’ll want to make sure you have a local development environment. If you’re using Linux, you can always use the traditional LAMP stack. If you’re using Mac this will be MAMP, and

Why do you need this?

Honestly, you don’t need to install Xdebug. But, if you do a great deal of PHP coding, it’s sure to make a lot of work easier. As the documentation says:

“Xdebug’s basic functions include the display of stack traces on error conditions, maximum nesting level protection and time tracking.”

With more informatin available to you (and your team, if you have one) means that you can more quickly and easily identify bugs that have got you stumped.

Here’s a comparison image of an error with Xdebug on and off:

Xdebug comparison error Source: Github

You could one has a single line while the other gives a detailed stack trace.

How to Install It?

First, you’ll need to download the appropriate files for the Xdebug version you want. You can do this from the Xdebug download page.

Then, proceed by following the steps below:

  1. Go to the Xdebug wizard page
  2. Paste the contents of your PHPInfo page here
  3. Click the button under the field to start the parsing processs

Now, Xdebug will analyse your PHP information and provide you with a file path to place the Xdebug executables.

Putting It All Together

As you proceed, here are a few resources you should check out from our Support Center:

And as always, be sure to leave a comment or question if you have one. We always appreciate feedback.

CM
Christopher Maiorana Content Writer II

Christopher Maiorana joined the InMotion community team in 2015 and regularly dispenses tips and tricks in the Support Center, Community Q&A, and the InMotion Hosting Blog.

More Articles by Christopher

Was this article helpful? Join the conversation!