To use the SQL Anywhere PHP extension on Linux or Solaris, you must copy the shared object from the SQL Anywhere installation directory and add it to your PHP installation. Optionally, you can add an entry to your PHP initialization file, php.ini, to load the extension, so you do not need to load it manually in each script.
Locate the php.ini file of 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 shared object from the lib32 or lib64 subdirectory of your SQL Anywhere installation to the directory specified by the extension_dir entry in the php.ini file. Your choice of shared object will depend on the version of PHP that you have installed and whether it is a 32-bit or a 64-bit version.
If your version of PHP is more recent than the shared object provided by SQL Anywhere, try using the most recent shared object provided. Note that a version 5.2.x SQL Anywhere PHP extension will not work with a version 5.3.x PHP.
For information about which version of the shared object to use, see PHP extensions.
Add the following line to the Dynamic Extensions section of the php.ini file to load the SQL Anywhere PHP driver automatically. The entry must identify the shared object you copied, which is either
or, for the thread-safe shared object,
where 5.x.y is the version number of the PHP shared object copied in the previous step.
Save and close php.ini.
An alternative to automatically loading the PHP driver is to load it manually in each script that requires it.
Before attempting to use the PHP extension, verify that your PHP execution environment is set up for SQL Anywhere. Depending on which shell you are using, you must edit the configuration script for your web server's environment and add the appropriate command to source the SQL Anywhere configuration script from the SQL Anywhere installation directory:
|In this shell...||Use this command...|
|sh, ksh, or bash||. /bin32/sa_config.sh|
|csh or tcsh||source /bin32/sa_config.csh|
The 32-bit version of the SQL Anywhere PHP extension DLL requires the bin32 directory to be in your path. The 64-bit version of the SQL Anywhere PHP extension DLL requires the bin64 directory to be in your path.
The configuration file in which this line should be inserted is different for different web servers and on different Linux distributions. Here are some examples for the Apache server on the indicated distributions:
The web server must be restarted after editing its environment configuration.
Discuter à propos de cette page dans DocCommentXchange.
|Copyright © 2012, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.1|