Creating and Installing the MaxDB PHP Extension on Linux

Use

You create the software for the MaxDB PHP extension from the source code and install this software on your computer.

Prerequisites

·        You need to have installed the following programs:

Ў        gcc compiler, version 2.95 or higher

Ў        autoconf, version 2.52 or higher

Ў        libtool, version 1.5.6 or higher

·        You need to have downloaded the source code for PHP 4.3.x or 5.0.x under php.net/downloads.php and unpacked this to a local directory <php_source> on your computer.

·        You have - at least - installed the MaxDB SQLDBC software (Base and SQLDBC software components). The installation path in the following is <independent_program_path>.

To be able to reproduce the test examples described in the following, you also require a database instance however. For this reason we recommend that you install the complete MaxDB software first, create a database instance, then load the tutorial data to this database instance. A very simple and safe way for this is using the Installation Manager.

Procedure

...

       1.      Create the directory <php_source>/ext/maxdb.

       2.      Download the MaxDB PHP package maxdb-<version>.tgz from PECL under pecl.php.net/package/maxdb and unpack it to a temporary directory on your computer.

tar –C <tmp_folder> –xvzf maxdb-<version>.tgz

    3.      Copy the contents of the directory <maxdb_version> to the directory <php_source>/ext/maxdb:

cp –r <tmp_folder>/<maxdb_version> <php_source>/ext/maxdb

       4.      Go to the directory <php_source>:

cd /<php_source>

       5.      Create the new scripts for compiling the source code. To do so, enter the following command:

./buildconf --force

       6.      Specify the parameters for creating the PHP software with MaxDB extension.

Ў        With the help of the with-maxdb option, define the directory <independent_program_path>.

Enter

§         The installation directory of SQLDBC if you have only installed the MaxDB SQLDBC software, or else

§         The directory for the programs and libraries used jointly by the MaxDB database instances and applications if you have installed the complete MaxDB software.

Ў        With the help of the prefix option, you can specify the directory <php_with_maxdb> into which MaxDB with PHP extension is to be installed. Note that you must have write authorizations for this directory in order to be able to create the software in it.

If you do not specify this option, the system uses the /usr/local directory as default.

 

Use the following command to display all possible options:

./configure --help

./configure --with-maxdb=<independent_program_path> --prefix=<php_with_maxdb> [--<parameter>] [...]

<parameter> :: = <option>=<value> | <option>

       7.      Open a root shell and create and install PHP with MaxDB extension using the following command:

make install

Result

PHP with MaxDB support has been compiled and installed in the directory <php_with_maxdb>.

You can display the list of all PHP extensions installed as a test to check the installation has been successful. To do so, enter the following command:

<php_with_maxdb>/bin/php –m

If no errors have occurred, the PHP extension maxdb is displayed in the list.

For other tests, see: Testing the MaxDB PHP extension (Linux)

Example

...

The source code for PHP 5.0.0 has been unpacked to directory /home/anna/php-5.0.0.

The SQLDBC software at minimum has been installed to the directory /opt/sdb/programs.

       1.      Create the directories /home/anna/php-5.0.0/ext and /home/anna/tmp.

       2.      Unpack the MaxDB PHP package maxdb-7[1].5.00.24.tgzto the directory /home/anna/tmp:

tar –C /home/anna/tmp –xvzf maxdb-7[1].5.00.24.tgz

You now have the following directory structure:

/home/anna/php-5.0.0/

  ext/

/home/anna/tmp/

  ext/

    maxdb/

      tests/

<independent_program_path>/

  lib/

  sdk/

     incl/

     lib/

       3.      Copy the contents of directory <maxdb_php>/ext/maxdb to <php_source>/ext:

cp –r /home/anna/tmp/ext/maxdb /home/anna/php-5.0.0/ext

       4.      Go to the directory where you unpacked the PHP source code.

cd /home/anna/php-5.0.0

       5.      Create the new scripts for compiling the source code.

./buildconf –force

       6.      With the help of the necessary options, specify that the programs and libraries used jointly by the MaxDB database instances and applications are stored in the directory /opt/sdb/programs, that PHP with MaxDB extension is to be installed in the directory /usr and that the software is to be created both without CGI and without LIBXML support:

./configure --with-maxdb=/opt/sdb/programs --prefix=/usr --disable-cgi –-disable-libxml

       7.      Create and install the PHP software with MaxDB extension:

make install