Configuring & Debugging XDebug with PHPStorm For Drupal 7 on Mac os X yosemite

Configuring & Debugging XDebug with PHPStorm For Drupal 7 on Mac os X yosemite

I am running my machine with nginx & php 5.6, First make sure that you have already installed Xdebug. We can check this with php version command

$ php -v

Xdebug check

If you see ‘Xdebug v’ that means XDebug installed. If you do not see then install XDebug using PECL

$ pecl install xdebug

If the extension is added to your php.ini file automatically, remove the following line:


And replace it with:


Restart your nginx and confirm XDebug is installed by checking php version OR you can also check with phpinfo in the browser.

check with phpinfo

Note =: to find php.ini or use $ locate or check phpinfo for php.ini location.

How to configure XDebug for PhpStorm ?

Open PhpStorm -> File -> Default Settings -> In the search box search with ‘debug’

configure XDebug for PhpStorm

Change ‘Debug port’ to 9001, apply and ok.

Open File -> Default Settings -> Search for ‘IDE Key’

Search for IDE Key

Set IDE key as ‘PHPSTORM’, Apply & OK

Now we need to add following XDebug values in php.ini, restart nginx & php-fpm


How to Configure Xdebug for Google Chrome ?

Enable google chrome extension Xdebug helper

Enable google chrome extension Xdebug helper

Once you have enabled extension then you need to add Debugger bookmarklets for chrome. Go to page & Generate XDebugger bookmarks

Note : IDE key should be PHPSTORM, as we set in PhpStorm settings.

IDE key

Now Drag & drop - Start debugger & Stop debugger to chrome bookmarks Bar. You should see the screen like below

chrome bookmarks Bar

Test debugging with Breakpoints for drupal 7

Now it’s time to debug our drupal 7 site with phpstorm & chrome

Open PhpStorm with drupal 7 project & click ‘Start listen for PHP Debug connections’ (These option are at Top Right corner)

Start listen for PHP Debug connections

Now open google chrome browser & click on ‘Start debugger’ in the bookmark toolbar.

Start debugger

Now add breakpoint in index.php file in PhpStorm.

add breakpoint in index.php

Then again visit chrome and load any page of these project (localhost/drupal7). For the first time phpstorm will ask for confirmation dialogue box to accept connection from google chrome. Once you accept it, you will see debug information like below.

debug information

Now you can debug by putting multiple breakpoints on your code.