Firebird Documentation Index → Setting up PHP and Firebird on Linux |
Table of Contents
This paper offers a succinct description of the steps we took to set up PHP 5 on Linux to work with Firebird.
Obtain the source code of Apache HTTP Server (2.2.8): http://apache.wildit.net.au/httpd/httpd-2.2.8.tar.bz2
Obtain the source code of PHP (5.2.5): http://au.php.net/get/php-5.2.5.tar.bz2/from/au2.php.net/mirror
Unpack httpd to, e.g.
/yourhome/apps/httpd-2.2.8
.
Unpack php to, e.g. /yourhome/apps/php-5.2.5
.
Be prepared with the path to Firebird installation in your system
(e.g. /opt/firebird
) and the paths to which you would like
Apache and PHP to be installed, e.g. /yourhome/inst/httpd
and /yourhome/inst/php
respectively.
Adjust the paths to suit your own configuration.
cd /yourhome/apps/httpd-2.2.8 ./configure --enable-so --prefix=/yourhome/inst/httpd make make install
cd /yourhome/apps/php-5.2.5 ./configure --with-interbase=/opt/firebird/ \ --with-apxs2=/yourhome/inst/httpd/bin/apxs --disable-libxml \ --disable-dom --disable-simplexml --disable-xml \ --disable-xmlreader --disable-xmlwriter --without-pear \ --prefix=/yourhome/inst/php make make install
These switches—
--disable-libxml \ --disable-dom --disable-simplexml --disable-xml \ --disable-xmlreader --disable-xmlwriter --without-pear
—are specific to our system, as pear
uses XML
and we don't have libxml
installed in our system. If you
have libxml
in your system, of course these switches are
unnecessary.
Run the following script. Make sure that the Firebird example employee
database is at the location specified in $dbname
.
<?php header("Content-Type: text/plain"); $dbname = '/opt/firebird/examples/empbuild/employee.fdb'; $dbuser = ''; $dbpassword = ''; $res = ibase_connect($dbname, $dbuser, $dbpass) or die(ibase_errmsg()); # # $sql = "SELECT * FROM Country"; $result = ibase_query($res, $sql) or die(ibase_errmsg()); echo ibase_num_fields($result); while($row=ibase_fetch_object($result)) { printf("%-15s %s\n", $row->COUNTRY, $row->CURRENCY); } ibase_free_result($result); ibase_close($res) or die(ibase_errmsg()); ?>
Firebird Documentation Index → Setting up PHP and Firebird on Linux |