## Testing the MaxDB PHP Extension (Linux)

### Use

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

### Prerequisites

· You must have created and installed the MaxDB PHP extension.

See: Creating and Installing the MaxDB PHP Extension on Linux

· You need to install the MaxDB software and create a database instance. This is located on the same computer as the PHP installation. If you want to use the MaxDB test scenario provided, you need to have loaded the tutorial data into the database instance.

See: Using the Installation Manager

### Procedure

...

1. Open a root shell and go to the <php_source> directory with 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 [maxdb] plus the values for the following variables:

Variable | Description
maxdb.default_db | Name of database instance
maxdb.default_user | Name of a valid database user
maxdb.default_pw | Password of the database user

4. Enter the path for the PHP installation in the environment variable TEST_PHP_EXECUTABLE.

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

cd <php_source>

6. To start the tests in the directory <test_program_folder>, 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 the directory /home/anna/php-5.0.0.

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

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

You use the MaxDB test scenario provided.

...

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

cd /home/anna/php-5.0.0

2. Copy the file php.ini-recommended 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 then enter the following:

[maxdb]

maxdb.default_db=DEMODB

maxdb.default_user=MONA

maxdb.default_pw=RED

4. Enter the path for the PHP installation in the environment variable TEST_PHP_EXECUTABLE.

Update the environment variables in a bash shell:

export TEST_PHP_EXECUTABLE=<php_with_maxdb>/bin/php

5. Go to the directory containing the source text: /home/anna/php-5.0.0. 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