Procedure documentationCreating and Installing the SAP MaxDB PHP Extension on Linux Locate this document in the navigation structure

 

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

Prerequisites

  • You 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 have downloaded the source code for PHP 4.3.x or 5.0.x from http://php.net/downloads.php and unpacked it to a local directory <php_source> on your computer.

  • You have installed the SAP MaxDB SQLDBC software (software components Base and SQLDBC). The SQLDBC files are stored in the following directories (in the following referred to as <sqldbc_path>):

    • Microsoft Windows:

      <installation_path>\pgm

    • Unix/Linux:

      <installation_path>\lib or <installation_path>\lib\lib64

    Note Note

    You can display the installation path using the dbm_getpath DBM command:

    dbmcli dbm_getpath InstallationPath

    For more information, see Database Manager CLI, dbm_getpath.

    End of the note.

Recommendation Recommendation

To reproduce the test examples described in the following, you also require a database. For this reason we recommend that you install the complete MaxDB software first, create a database and load the tutorial data to this database.

End of the recommendation.

Procedure

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

  2. Download the MaxDB PHP package maxdb-<version>.tgz from http://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 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 the SAP MaxDB extension:

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

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

    • Using the option with-maxdb, define the directory <sqldbc_path>.

      • If you have only installed the SAP MaxDB SQLDBC software, enter the installation directory of SQLDBC.

      • If you have installed the complete SAP MaxDB software, enter the directory for the programs and libraries used jointly by the SAP MaxDB databases and applications (<global_programs_path>).

    • Using the prefix option, you can specify the directory <php_with_maxdb> into which PHP with the SAP MaxDB is to be installed. Note that you need write permissions for this directory 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.

      Note Note

      To display all options, use the following command:

      ./configure --help

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

    make install

Result

PHP with SAP MaxDB support has been compiled and installed.

To check whether the installation has been successful, display the list of all installed PHP extensions installed using the following command:

<php_with_maxdb>/bin/php –m

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

More information: Testing the SAP MaxDB PHP Extension on Linux

Example

You have unpacked the source code for PHP 5.0.0 to the directory /home/anna/php-5.0.0

You have installed the SQLDBC software in the directory /opt/sdb/Installation_5/lib

You create and install the SAP MaxDB PHP extension as follows:

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

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

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

  3. Copy the contents of the 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. Using options, specify that the programs and libraries used jointly by the SAP MaxDB databases and applications are stored in the directory /opt/sdb/globalprograms, that PHP with SAP 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/globalprograms --prefix=/usr --disable-cgi –-disable-libxml

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

    make install