Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SAP Sybase SQL Anywhere 16.0 » SQL Anywhere Server - Programming » SQL Anywhere external environment support » The PHP external environment

 

Installing the PHP external environment module on Windows or Unix

Install the external environment module to support PHP in the database.

Prerequisites

  1. A copy of PHP must be installed on the database server computer and SQL Anywhere database server must be able to locate the PHP executable.

  2. The SQL Anywhere PHP driver (shipped with SQL Anywhere) must be installed on the database server computer and PHP must be configured to use it. See PHP client deployment.

Context and remarks

In addition to the above two prerequisites, the database administrator must also install the SQL Anywhere PHP External Environment module. Prebuilt modules for several versions of PHP are included with the SQL Anywhere distribution. To install prebuilt modules, copy the appropriate driver module to your PHP extensions directory (which can be found in php.ini). On Unix, you can also use a symbolic link. The following steps describe how to do this.

 Task
  1. 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, set it to point to an isolated directory for better system security.

  2. Copy the desired external environment PHP module from the SQL Anywhere installation directory to your PHP installation or extensions directory. Change the x.y to reflect the version you have selected.

    For Windows, use a command like the following:

    copy "%SQLANY16%\Bin32\php-5.x.y_sqlanywhere_extenv16.dll" php-ext-dir

    For Unix, use a command like the following:

    cp $SQLANY16/bin32/php-5.x.y_sqlanywhere_extenv16.so php-ext-dir

    In the above examples, php-ext-dir is the path to your PHP extensions directory (for example, c:\php\ext).

  3. Add a 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.

    For Windows, add the following line:

    extension=php-5.x.y_sqlanywhere_extenv16.dll

    For Unix, add the following line:

    extension=php-5.x.y_sqlanywhere_extenv16.so
  4. Save and close php.ini.

  5. Make sure that you have also installed the SQL Anywhere PHP driver from the SQL Anywhere installation directory into your PHP extensions directory. This file name prefix follows the pattern php-5.x.y_sqlanywhere where x and y are the version numbers. It should match the version numbers of the file that you copied in step 2.

Results

The external environment module is installed.