Lonely Coder
Published in

Lonely Coder

Enabling php7 XDebug for VS Code on Ubuntu 16.04

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 below command in terminal to ensure xdebug is installed properly. You’ll find xdebug in the list.

php -m

Make sure your php mods-available folder contains xdebug.ini file and this file contains below line:


** Default xdebug location: /etc/php/7.0/mods-available/xdebug.ini

Now, add below lines at the bottom of your php.ini file:


Finally restart apache.

sudo service apache2 restart

And start php-debugging from VS-code.

php-debug, source: https://goo.gl/5nI77s


 by the author.



A Full-Stack Software Developer From Dhaka, Bangladesh

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store