Install Xdebug with PHP-FPM and integrate with PHPstorm IDE in Ubuntu 14.04

I have a PHP 7 with nginx server installed in Ubuntu 14.04.

First you have to install xdebug

sudo apt-get install php-xdebug

Then restart the php-fpm and nginx service.

sudo service php7.0-fpm restart

sudo service nginx restart

Check phpinfo to check xdebug is installed.

Edit xdebug file to add lines to enable remote debug and change default port for xdebug from 9000 which is used by php-fpm to 9001(any of your choice).

sudo vim /etc/php/7.0/mods-available/xdebug.ini

Add these lines

xdebug.remote_port=9001
xdebug.remote_enable=on

Restart the php-fpm and server

sudo service php7.0-fpm restart

sudo service nginx restart

In PHPstorm Goto File->Settings

Select

Languages & Frameworks ->PHP->Debug

and change the xdebug port to 9001(Port no. given above)

Also install xdebug extension for your browser and enable in the browser where you want to debug.

Happy Debugging!!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s