Show TOC

Testing the SAP MaxDB PHP Extension on LinuxLocate this document in the navigation structure

Use

You test the functions of the SAP MaxDB PHP extension. You can either use the test scenario included in the SAP MaxDB PHP package for this or develop your own tests.

Prerequisites
  • You have created and installed the SAP MaxDB PHP extension.

    More information: Creating and Installing the MaxDB PHP Extension on Linux

  • You have installed the SAP MaxDB software and created a database. This database must be located on the same computer as the PHP installation. If you want to use the SAP MaxDB test scenario provided, you need to have loaded the demo data into this database.

    More information: Concepts of the Database System, Demo Database

Procedure
  1. Open a root shell and go to the <php_source> directory containing the PHP source code:

    cd <php_source>

  2. Copy the file php.ini-recommended to the directory <php_with_maxdb>/lib and change the name of this file to php.ini:

    cp php.ini-recommended <php_with_maxdb>/lib/php.ini

  3. Open the <php_with_maxdb>/lib/php.ini file in an editor and enter the following information:

    [maxdb]

    maxdb.default_db=<database_name>

    maxdb.default_user=<database_user_name>

    maxdb.default_pw=<database_user_password>

  4. Add the path for the PHP installation to the environment variable TEST_PHP_EXECUTABLE.

  5. Go to the directory <php_source> containing the PHP source code. This directory contains the run-tests.php script for testing PHP.

    cd <php_source>

  6. To start the tests in the <test_program_folder> directory, enter the following command:

    php run-tests.php <test_program_folder>

Result

You can see information on which tests were successful and which have failed.

Example

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

You have created the SAP MaxDB PHP extension and installed it in the /usr directory.

You have installed the SAP MaxDB software and created the DEMODB database as well as the database user MONA with the password RED.

You use the SAP MaxDB test scenario.

  1. Go to the directory /home/anna/php-5.0.0:

    cd /home/anna/php-5.0.0

  2. Copy the php.ini-recommended file contained within to the directory /usr/lib and change the name of this file to php.ini:

    copy php.ini-recommended/usr/lib/php.ini

  3. Open the file /usr/lib/php.ini in an editor program, then insert the following:

    [maxdb]

    maxdb.default_db=DEMODB

    maxdb.default_user=MONA

    maxdb.default_pw=RED

  4. Add the path for the PHP installation to the environment variable TEST_PHP_EXECUTABLE.

    Example

    Bash shell:

    export TEST_PHP_EXECUTABLE= <php_with_maxdb>/bin/php

  5. Go to the directory /home/anna/php-5.0.0 containing the PHP source code. This directory contains the run-tests.php script for testing PHP.

    cd /home/anna/php-5.0.0

  6. To start the tests, enter the following command:

    php run-tests.php /home/anna/tmp/ext/maxdb/tests