Install PHP and create a PHP script before installing the new PHP object into the
SAP Sybase IQ database.
Prerequisites
Install
PHP on the database server computer. The database server computer must be able
to locate the PHP executable.
Install the SQL Anywhere PHP extension on the database server computer.
Task
Locate the php.ini file for your PHP installation, and open it in a text editor. Locate the line that specifies the location of the extension_dir directory. If extension_dir is not set to any specific directory, it is a good idea to set it to point to an isolated directory for better system security.
Copy the desired external environment PHP module from the SAP Sybase IQ
installation directory to your PHP installation directory. Change the x.y to
reflect the version you have selected.
Add the following line to the Dynamic Extensions section of the php.ini file to load the external environment PHP module automatically. Change the x.y to reflect the version you have selected.
extension=php-5.x.y_sqlanywhere_extenv12.so
Save and close php.ini.
Make sure that you have also installed the SQL Anywhere PHP driver from the
SAP Sybase IQ installation directory into your PHP
extensions directory. This file name follows the pattern
php-5.x.y_sqlanywhere.so where x and
y are the version numbers.
Verify the database server can locate and start the PHP executable:
ALTER EXTERNAL ENVIRONMENT PHP
LOCATION 'php-path';
Write your PHP script. The <?php and ?> tags tell the web server that it should let PHP execute the code that lies between them and replace it with the PHP output. This connect.php example attempts to make a connection to a database on a local server:
<?php
# Connect using the default user ID and password
$conn = sasql_connect( "UID=DBA;PWD=sql" );
if( ! $conn ) {
echo "Connection failed\n";
} else {
echo "Connected successfully\n";
sasql_close( $conn );
}?>