Thursday, June 29, 2006

Dbase, PHP and Ubuntu

I needed to have PHP compiled with dBase for webdevelopment. dBase was dropped from the standard libraries of Ubuntu at version 5.04 and I couldn't find any solution for installing PHP with dBase support.

I don't imagine this will help the community much, but I had a specific need and finally worked out the solution. Its here mainly for my sanity should I need to replicate it in the future.

NB. It will work for the installation and removal of other PHP components.

Install some packages you'll need later on:
sudo apt-get install shtool dpkg-dev
Download the PHP source file
sudo apt-get source php5
We need to alter the rules to allow PHP compilation with dBase support.
Enter the new PHP directory
Edit the rules file ./debian/rules
Change the COMMON_CONFIG statement
add: "--enable-dbase \"
Now we need to build dependancies and then build PHP. The building of the dependancies requires a significant download and the PHP build tends to take a fair amount of time.
sudo apt-get build-dep php5
sudo dpkg-buildpackage
Once this has finally finished, the .deb files will have been created - if they aren't in the current directory try it's parent.

The final job is to install the new PHP library, copy it to the apache modules folder and then restart apache.
sudo dpkg -i php5*.deb
sudo cp ~/php5-*/apache2-build/libs/libphp5.so /usr/lib/apache2/modules/libphp5.so
sudo /etc/init.d/apache2 restart

5 comments:

Anonymous said...

Thanks, that's be usefull

Anonymous said...

I tried the same thing but when I got to buildpackage it gave a lot of errors and warnings..and the .deb files weren't there

Dave said...

You rock. I was really disappointed when I couldn't run my old PHP scripts in Ubuntu. Your instructions worked flawlessly for me on Intrepid. Now if only I didn't have to re-compile PHP to use a couple of stupid dbase functions...

Dave said...

A quick question: Now the Update Manager is asking me to update php5-dbg, php5-cli, and php5-cgi. Is there a way to tell it that I want to use my custom-compiled versions and not nag about updating them?

Unknown said...

Don't think so. We finally moved all our dbase dbs into Postgres, so I don't have to manaually recompile PHP each time we get security fixes. Life is so much simpler.