Click here to Skip to main content
Click here to Skip to main content

How to install and configure Xdebug to work with PHP5 on Ubuntu

By , 15 Jul 2010
 

The Xdebug extension helps you debugging your script by providing a lot of valuable debug information.

Before you install xdebug you should have PHP5 and Apache2 already working properly. Use the terminal to execute the following steps.

  1. Install the latest version of xdebug in PEAR repository:
    sudo apt-get install php5-dev php-pear
  2. Install xdebug through PECL:
  3. sudo pecl install xdebug
  4. Now, you need to find the path of the compiled module (xdebug.so):
  5. find / -name 'xdebug.so'

    Copy the found file-path to use in the next steps.

  6. Now we need to configure xdebug with PHP5, so open the php.ini file (usually you'll find it in /etc/php/apache2/php.ini) use gedit to edit the file:
  7. sudo gedit /etc/php/apache2/php.ini

    OR, use the pwerful text editor vim:

    sudo vim /etc/php/apache2/php.ini
  8. Add the following lines to the file [Note that the first line should contain the file path found in step number 3]:
  9. zend_extension="/usr/lib/php5/20060613/xdebug.so"
    xdebug.remote_enable=1
    xdebug.remote_handler=dbgp
    xdebug.remote_mode=req
    xdebug.remote_host=localhost
    xdebug.remote_port=9000
  10. Finally, you need to restart apache for the changes to take effect:
  11. sudo /etc/init.d/apache2 restart

To verify that the extention is loaded and configured correctly, check the phpinfo()

The following line should have been appended to the copyright lines:
with Xdebug v2.0.0, Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, by Derick Rethans

For full xdebug extention information, please read the official documentation at http://xdebug.org/docs/

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

DareenH
Software Developer (Senior) Softact
Jordan Jordan
Member
No Biography provided

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
Hint: For improved responsiveness ensure Javascript is enabled and choose 'Normal' from the Layout dropdown and hit 'Update'.
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
-- There are no messages in this forum --
Permalink | Advertise | Privacy | Mobile
Web02 | 2.6.130523.1 | Last Updated 15 Jul 2010
Article Copyright 2010 by DareenH
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid