Hi. You've reached Nigel.in
This site is still in its very early stages, but what you have landed on, possibly inadvertently, is the website of a certain curious character a.k.a Nigel Fernandes
The aim of this page was to serve as a landing point for those of you who want to know a little more about me. The links on the right and left will take you deeper my world, or possibly on to different exciting things.
Its a big web out there and this is just one more street for you to saunter down. I hope you like it.
Close this.
About Me

- Name: Nigel Fernandes
- Location: Panjim, Goa, India
Crazy, dancing, programming, Goan.. I'm a computer geek and proud to be one. I program in Java, Ruby and .Net, PHP, Javascript. A lot of my recent work has been about CSS and UI design practices for large scale websites and Agile teams. I still while away hours dreaming up a web startup.
Installing Xdebug for PHP on Centos 4 (server)
Friday, August 24, 2007
I needed a good debugging tool for PHP 5, and decided to jump into the world of live debugging. Turns out, in the case of PHP thats not such a hot place to be in. But thats a tale for another day.After scanning the possible offerings, I narrowed it down to the two main options.
Since Xdebug was open sourced and supported a pretty nice feature list, it was promptly selected.
So then I had to go about getting installed and setup on a Centos 4 based test environment. After some searching I still hadn't found the exact instructions.
So for those of you who need to install Xdebug, here is what you need to do.
- You need to have PHP 5 and PECL installed and working with Apache already.
- You need to install PHP's devel package. This is needed for the command phpize to work. Note that you need to have the CentosPlus repository enabled for this. So from the terminal as root run the command:
yum install php-devel
- Next you need to have GCC and GCC C++ compilers installed. The only way to install Xdebug on linux as of time of writing this is to compile the extension yourself. The good thing is that this turns out to be is really easy. Note that you also need Autoconf and Automake packages. Once again from the terminal as root run the command:
yum install gcc gcc-c++ autoconf automake
- Next its time to get the Xdebug package for php itself, and compile and install it. That is as simple as typing the following command as root:
pecl install Xdebug
- Now you need to configure your PHP to load the extension. On Centos, extensions are loaded from a folder most likely to be located at /etc/php.d In this folder you are most likely a bunch of .ini files corresponding to what ever extensions you have installed for use with PHP. You now need to create a file called xdebug.ini here as root. Next add the following lines to the file:
; Enable Xdebug extension module
extension=xdebug.so
; Configure the extension [See Xdebug documentation for options to add here]
xdebug.remote_enable=
xdebug. ..... - Restart Apache with service httpd restart and check the output of phpinfo() to see the if Xdebug is loaded and configured correctly.
In case anybody was wondering where the xdebug.so lives on Centos well my system has it sitting at /usr/lib/php/modules/xdebug.so Doing a simple locate xdebug.so should help you locate it.
Anyways this should be enough to get you up and debugging. I still don't have a satisfactory visual client for Xdebug on Linux, but I shall be experimenting with Eclipse's PDT client over the next few days. Will post later on that.
Labels: PHP debugging centos linux
http://protoeditor.sourceforge.net/
It's an awesome integration of Kate and debugging support
Thanks for the link. It seems to be a sweet little editor. We are going to put it through its paces in our dev shop and see how it does.
Will post if it meets the bar.
Cheers.
Nigel
Sorry mate, no idea.
Sounds like your apache is loading a different PHP .ini file as compared to command line PHP
Installing with PEAR/PECL is as easy as:
# pecl install xdebug
but you still need to add the correct line to your php.ini: (don't forget to change the path and filename to the correct one — but make sure you use the full path)
zend_extension="/usr/local/php/modules/xdebug.so"
Dont use
extension=xdebug.so
but instead use
zend_extension=/usr/lib64/php/modules/xdebug.so
in the /etc/php.d/xdebug.ini file
I'm using Centos 5.4 with php5.1.6
In order to get my Netbeans debugger to "work" (meaning that it actually stops at the breakpoints), I had to move the xdebug.so file into a sub-directory (I used "/usr/lib/php/modules/Xdebug/xdebug.so") and reference that file from the xdebug.ini file. Not sure why this worked, but just trying to save someone else the time I spent figuring this out.
Subscribe to Post Comments [Atom]
<< Home

