This post summarizes the steps to setup debugging using Xdebug for PHP in PHPStorm 6 (one of the best PHP IDE). This post is a more comprehensive version of this previous post.

This post is for Linux environment

1. Install Xdebug

Xdebug can be installed from the PECL repository, which is part of PEAR. PECL required php5-dev package. Use the following commands to install these prerequisites:

sudo apt-get install php5-dev
sudo apt-get install php-pear

Afterwards, Xdebug can be installed via PECL:

sudo pecl install xdebug

When installation is done, PECL will output where Xdebug is installed as follows:

Build process completed successfully
Installing '/usr/lib/php5/20090626/'
install ok: channel://
configuration option "php_ini" is not set to php.ini location
You should add "" to php.ini

Modify your php.ini accordingly. My php.ini is located at /etc/php5/apache2/php.ini. I added the following lines to the end of my php.ini.


Restart Apache

2. Modify PHPStorm Settings

Go into Files -> Settings -> Click on PHP. Select an interpreter. The screen should look like follows.


Click on ‘…’ for Interpreter. The Interpreters window shows up (see below). Click on the green +, and an interpreter. Choose Xdebug for debugger and click OK.

PHPStorm6 Add Interpreter

Click on Debug in the Settings Window. The settings should match what you get back from installing Xdebug.


Click on Apply button and OK.

3. Debug Configuration

Go into Run -> Edit Configurations.

Screenshot-Run-Debug Configurations

Click on the “green plus” and select PHP Web Application

Next to Server, click on the “…” button and servers settings shows up. Click on the green plus to add a server setting. Use the following settings:

  • Name: can be anything
  • Host: localhost
  • Port: 80
  • Debugger: Xdebug


Click on OK

Back in the Run/Debug Configurations window, change the Start URL to the URL of your application (see figure above), and click OK.