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
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.
Note =: to find php.ini or xdeboug.so 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’
Change ‘Debug port’ to 9001, apply and ok.
Open File -> Default Settings -> 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
xdebug.remote_port=9001 xdebug.remote_enable=1 xdebug.idekey=PHPSTORM
How to Configure Xdebug for Google Chrome ?
Enable google chrome extension Xdebug helper
Once you have enabled extension then you need to add Debugger bookmarklets for chrome. Go to https://www.jetbrains.com/phpstorm/marklets/ page & Generate XDebugger bookmarks
Note : IDE key should be PHPSTORM, as we set in PhpStorm settings.
Now Drag & drop - Start debugger & Stop debugger to chrome bookmarks Bar. You should see the screen like below
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)
Now open google chrome browser & click on ‘Start debugger’ in the bookmark toolbar.
Now add breakpoint in index.php file in PhpStorm.
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.
Now you can debug by putting multiple breakpoints on your code.