Firebird Documentation Index → Setting up PHP and Firebird on Linux
Firebird Home Firebird Home Firebird Documentation IndexNext: Document History

Setting up PHP and Firebird on Linux

Iman Suyoto

Linfox Armaguard IT,
Australia

4 March 2008 v.1.0.1


Table of Contents

Setting up PHP and Firebird on Linux
A. Document History
B. License Notice

Setting up PHP and Firebird on Linux

This paper offers a succinct description of the steps we took to set up PHP 5 on Linux to work with Firebird.

Preparation

  1. Obtain the source code of Apache HTTP Server (2.2.8): http://apache.wildit.net.au/httpd/httpd-2.2.8.tar.bz2

  2. 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.

  3. 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.

Build and Installation

Warning

Adjust the paths to suit your own configuration.

Apache

cd /yourhome/apps/httpd-2.2.8

./configure --enable-so --prefix=/yourhome/inst/httpd

make

make install
        

PHP

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
        

Note

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.

Testing

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 IndexNext: Document History
Firebird Documentation Index → Setting up PHP and Firebird on Linux