Installing Xdebug on Ubuntu

You are here

xdebug php info

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 xdebug.so 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
zend_extension="/usr/lib/php5/20100525/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_handler=dbgp xdebug.remote_mode=req
xdebug.remote_host=127.0.0.1 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

xdebug php info

AttachmentSize
139 bytes