Subject Firebird, PHP, and CentOS 5
Author Dan Wilson
In response to a private email request, I put together the procedure I
used in order to get native and PDO firebird support working with PHP
and CentOS 5. I was unsuccessful using the FAQ at
http://www.firebirdfaq.org/faq191/, and couldn't find any other tricks
on the web that worked. So, I compiled from a fedora source RPM as follows:

1. Download php 5.2.6 source rpm from fedora 8 repository (I assume F9
source rpm would also work, but went with 8 as I suspected it would be
closer to CentOS).
2. Install rpmbuild package (yum install rpm-build)
3. Create rpmbuild subdirectory under your home directory: mkdir
~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
4. Create .rpmmacros file in home directory: echo "%_topdir %(echo
$HOME)/rpmbuild" >.rpmmacros
5. install source rpm: sudo rpm -i php-5.2.6-2.fc8.src.rpm
6. Edit ~/rpmbuild/SPECS/php.spec:

--- php.spec.orig 2008-10-29 09:41:07.000000000 -0700
+++ php.spec 2008-10-29 09:45:15.000000000 -0700
@@ -478,6 +478,8 @@
--with-libxml-dir=%{_prefix} \
--with-xml \
--with-system-tzdata \
+ --with-interbase=/opt/firebird \
+ --with-pdo-firebird=shared,/opt/firebird \
$*
if test $? != 0; then
tail -500 config.log
@@ -523,7 +525,9 @@
--with-mcrypt=shared,%{_prefix} \
--with-mhash=shared,%{_prefix} \
--with-tidy=shared,%{_prefix} \
- --with-mssql=shared,%{_prefix}
+ --with-mssql=shared,%{_prefix} \
+ --with-interbase=/opt/firebird \
+ --with-pdo-firebird=shared,/opt/firebird
popd

# Build Apache module, and the CLI SAPI, /usr/bin/php
@@ -605,7 +609,7 @@
for mod in pgsql mysql mysqli odbc ldap snmp xmlrpc imap \
mbstring ncurses gd dom xsl soap bcmath dba xmlreader xmlwriter \
pdo pdo_mysql pdo_pgsql pdo_odbc pdo_sqlite json zip \
- dbase mcrypt mhash tidy mssql; do
+ dbase mcrypt mhash tidy mssql pdo_firebird; do
cat > $RPM_BUILD_ROOT%{_sysconfdir}/php.d/${mod}.ini <<EOF
; Enable ${mod} extension module
extension=${mod}.so
@@ -626,6 +630,7 @@
cat files.pdo_mysql >> files.mysql
cat files.pdo_pgsql >> files.pgsql
cat files.pdo_odbc >> files.odbc
+cat files.pdo_firebird >> files.pdo

# Package pdo_sqlite with pdo; isolating the sqlite dependency
# isn't useful at this time since rpm itself requires sqlite.


I chose to package firebird-pdo right into the core pdo package rather
than create a separate package for it - since this was for my own use
and not as a public rpm, I didn't see the need.

7. use rpmbuild to build new binary packages (rpmbuild -bb php.spec)
8. Install new php packages (on my 32-bit linux install, they are found
in ~/rpmbuild/RPMS/i386 directory) using rpm -U
9. Execute php info command from web server or command line:
echo "<?php phpinfo(); ?>" >phptest.php
php <phptest.php
You should now see the interbase module present:

interbase

Firebird/InterBase Support => static
Compile-time Client Library Version => Firebird API version 20
Run-time Client Library Version => LI-V6.3.3.12981 Firebird 2.0

Directive => Local Value => Master Value
ibase.allow_persistent => On => On
ibase.dateformat => %Y-%m-%d => %Y-%m-%d
ibase.default_charset => no value => no value
ibase.default_db => no value => no value
ibase.default_password => no value => no value
ibase.default_user => no value => no value
ibase.max_links => Unlimited => Unlimited
ibase.max_persistent => Unlimited => Unlimited
ibase.timeformat => %H:%M:%S => %H:%M:%S
ibase.timestampformat => %Y-%m-%d %H:%M:%S => %Y-%m-%d %H:%M:%S

and Firebird PDO support:

PDO

PDO support => enabled
PDO drivers => firebird, mysql, sqlite

PDO_Firebird

PDO Driver for Firebird/InterBase => enabled


It is also possible to get the native firebird module working as a
shared library too, but I lost the procedure I used at one point to do
that, and haven't been able to recreate the "magic" since, so I've stuck
with static linking.


I hope this helps someone!

Dan.