Skip to main content

Installing Xdebug on Ubuntu

Need to install xdebug on Ubuntu so you can test that really cool PHP web app that will wow users for a decade? The first thing you need to achieve that goal is have Ubuntu installed and the lamp stack ready to go. Next open the terminal and install xdebug by using the following command.

~$ sudo apt-get install php5-xdebug

Next open the php ini file on Ubuntu so that we can ensure that xdebug is being seen by the PHP engine, again from the terminal ensure you have vim installed or you can use gedit and open php.ini file

~$ sudo vim /etc/php5/apache2/php.ini

At the bottom of the file add the following make sure you test the path to the module as it does change. Always look through the php.ini and ensure that any reference to Zend Debugger is also commented out.

# Added for xdebug
xdebug.remote_handler=dbgp xdebug.remote_mode=req
xdebug.remote_host= xdebug.remote_port=9000

Now restart Apache.

~$ sudo service apache2 restart

To ensure that all is working well I have attached a phpinfo() file, add it to the root directory of your local website development machine, usually the default for Ubuntu is /var/www and if everything is working you should get something like the image below in your browser

You cannot send more than 5 messages in 1 hour. Try again later.