Enabling php7 XDebug for VS Code on Ubuntu 16.04

Ahmed Shibli
Dec 22, 2016 · 1 min read

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


Lonely Coder

A Full-Stack Software Developer From Dhaka, Bangladesh

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

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