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.
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
Open a root shell and go to the <php_source> directory containing the PHP source code:
cd <php_source>
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
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>
Add the path for the PHP installation to the environment variable TEST_PHP_EXECUTABLE.
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>
To start the tests in the <test_program_folder> directory, enter the following command:
php run-tests.php <test_program_folder>
You can see information on which tests were successful and which have failed.
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.
Go to the directory /home/anna/php-5.0.0:
cd /home/anna/php-5.0.0
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
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
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
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
To start the tests, enter the following command:
php run-tests.php /home/anna/tmp/ext/maxdb/tests