Sometimes I have to work on our old projects written in PHP. Recently, I am using VS code as my php IDE. VS Code has some great features. I can debug my code easily with XDebug and php-debug VS code extension. But, after upgrading my OS to Ubuntu 16.04, I was facing trouble installing xdebug. Most of the google search refers to php5 XDebug. But, in Ubuntu 16.04 default php version is php7.
So, after searching for a while, I found the solution is pretty simple. Install php-xdebug.
sudo apt-get install php-xdebug
Run the below command in the terminal to ensure xdebug is installed properly. You’ll find xdebug in the list.
Make sure your php mods-available folder contains xdebug.ini file and this file contains below line:
Default xdebug.ini location:
Now, add the below lines at the bottom of your
[XDebug] xdebug.remote_enable=1 xdebug.remote_autostart=1
Finally restart apache.
sudo service apache2 restart
And start php-debugging from VS-code.
php-debug, source: https://goo.gl/5nI77s