Tuesday, December 25, 2007

building xdebug in linux machine

Though the instructions at xdebug.org were good, I still had a little hard time getting through the details. It took me a while to understand and get xdebug running in my linux machines. I tried with ubuntu gusty server (7.10) and fedora core 5, and had xdebug compiled and built in both.

You may also want to see the instruction at xdebug.

First download xdebug source from xdebug.org
I prefer wget.
#wget http://www.xdebug.org/files/xdebug-2.0.2.tgz

Untar tgz file and go into the xdebug-2.0.2 folder
#tar -xzf xdebug-2.0.2.tgz
#cd xdebug-2.0.2

To build the php extension, you need several binaries like phpize, php-config (part of php-dev package). The chances are your system may not have this particular package.

#apt-get install php5-dev (in ubuntu)
#yum install php5-dev (in fedora)

will automate the nitty-gritty job of solving dependencies. Some may even ask to upgrade mysql-server along with php depending upon the versions in your machine. Make sure your data are backed-up, before you say yes to install and upgrade dependencies packages.

After the installation, phpize should be available. phpize is a shell script to prepare PHP extension for compiling. Believe me I couldn't find the purpose of phpize anywhere in the internet. Maybe I haven't searched enough :(
Run phpize in your xdebug source directory. phpize generates several files, necessary for compiling, building the xdebug extension.

#phpize
will give the following output
Configuring for:
PHP Api Version: 20041225
Zend Module Api No: 20050922
Zend Extension Api No: 220051025
You will see that 'configure' script and several others are created.

#./configure --enable-xdebug

See the install instruction, if you get any errors. I didn't run into any. Hope you won't too.

#make
will build the extension xdebug.so in modules directory.

Move the extension to any folder you want. I moved to /opt/phpmodules/xdebug.so

You may either put the extension loading statement in php.ini or you may create a new ini file (xdebug.ini) in php.d directory. The configuration files will be automatically read from this directory (/etc/php5/conf.d in my case) and the extensions get loaded.

I wrote the following line to xdebug.ini
zend_extension="/opt/phpmodules/xdebug.so"
restart the apache server.

Load phpinfo (write a php script that calls phpinfo()) from the browser. If everything goes fine, you should see that xdebug module and zend logo in the browser.

#php -m
will also show xdebug under "PHP Modules" and "Zend Modules".

Congratulation. xDebug is successfully built and installed.

1 comment:

MoneyBonanza said...

Want $5000 for Giving Away Free Bonuses?
Want to earn thousands this week. All you do is give away a bonus worth
a ton of loot. Everyone who views this bonus wants it and takes
a free tour. Over 500 people a day are joining.
You get paid boatloads for just giving away a bonus they already want.
It really doesn't get any easier. We are paying out Huge Commissions to
Internet Newbies for doing this one simple thing.
So if your sick of crap that does not pay and you want to earn thousands this week.
Come get your huge bonus and take a free tour and duplicate this.
It works and we're paying out over 100,000 a week. Right now your missing your share.
So come get it
http://www.lwsfreedom.com/id/greentitan
WE Give YOU $1000 in FREE ADVERTISING
Sick of hype and stuff that doesn't work?
See the difference here. We even Give You $1000 in Free Advertising. Imagine your Ad on all the major search engines and we're paying for it. If your ready to start earning thousands and want to use our dime to do it take a free tour today
Stop Trying We Close Your Sales and PAY YOU Period
We have the only system that has internet newbies earning a ton of cash. Why? Because Millionaire internet Marketers do all of your follow up and close all your sales. Don’t worry there are no monthly fees for them to do this. I'm sure your skeptical so here's a deal. I'll give you a HUGE Bonus for me to Prove this to you. You have nothing to lose but big commissions. Take a free tour and see how we will do the work and pay you a fortune.
http://www.lwsfreedom.com/id/greentitan