Configure Xdebug + PHP 7 + Nginx + Any Linux Distribution

Subscribe to my newsletter and never miss my upcoming articles

Xdebug deepens debugging PHP apps and websites to a level you can’t receive from the manual process of using code level var_dump()

Get your php.ini

Next output your php.ini information into a file or place you can get the information from. I like to save mine to a file called php-info.txt

sudo php -i > ~/php-info.txt

Use the Xdebug Wizard

Send the text file information into the wizard at Xdebug Wizard. Then follow the instructions the wizard supplies.

Install php-xdebug

This will connect the php with xdebug to the editor also you can configure like editors and remote configurations.

Debian based distributions( Debian, Ubuntu, Linux Mint)

sudo apt install php-xdebug

Arch Linux

sudo pacman -Sy xdebug

Edit xdebug.ini

Now edit the xdebug.ini

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

Then paste the following configuration

xdebug.remote_autostart = 1
xdebug.remote_enable = 1
xdebug.remote_handler = dbgp
xdebug.remote_host =
xdebug.remote_log = /tmp/xdebug_remote.log
xdebug.remote_mode = req
xdebug.remote_port = 9005 #this can be modified

Restart the services

sudo systemctl restart php7.0-fpm
sudo systemctl restart nginx

Configure the editor

In my case, I am using Sublime Text 3 so installed xdebug package using package control

Restart the sublime text.

That’s all. You have configured Xdebug successfully !!!

If you have any issues, Just comment below

No Comments Yet