07/08/2018, by Ivan

Firstly, we need to install php library for xdebug:

sudo apt update
sudo apt install php7.2-xdebug

For other versions of PHP you can use php7.x-xdebug or php5.x-xdebug for PHP 5.x versions.

Further we need to see /usr/lib/php folder and find our xdebug.so file. 

cd /usr/lib/php

PHP xdebug

I have few PHP versions on my local machine, so I have xdebug.so for PHP 7.2 version in 20170718 folder, 20160303 for PHP 7.1 and so on.

Path to xdebug.so must be added to /etc/php/7.2/apache2/php.ini (or any other specified version of PHP):

xdebug.extended_info = 1
xdebug.idekey = "PHPSTORM"

You can add these settings just to the end of php.ini file. I usually use nano editor to change configs:

sudo nano /etc/php/7.2/apache2/php.ini

Use Ctrl + O for saving changes and Ctrl + X to close nano editor.

After changing configs we need to restart apache:

sudo service apache2 restart

You can also add these settings in cli config, but I don't recommend to do this, because composer works slower with enabled xdebug. 

Note: I use PhpStorm IDE, so I added idekey - PHPSTORM, if you use another IDE you should use another idekey, for example ECLIPSE_DBGP or netbeans-xdebug.

You also need chrome extension to enable xdebug for site:



No war