To use the SQL Anywhere PHP module on Windows, you must copy the DLL from the SQL Anywhere installation directory and add it to your PHP installation. Optionally, you can add an entry to your PHP initialization file to load the module, so you do not need to load it manually in each script.
To install the PHP module on Windows
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 file php-5.x.y_sqlanywhere.dll, where 5.x.y is the PHP version number from the Bin32 subdirectory of your SQL Anywhere installation, to the directory specified by the extension_dir entry in the php.ini file.
If your version of PHP is more recent than the SQL Anywhere PHP modules provided by SQL Anywhere, try using the most recent module provided. For example, if you installed PHP 5.2.7, and the most recent SQL Anywhere PHP module is php-5.2.6_sqlanywhere.dll, use php-5.2.6_sqlanywhere.dll.
Add the following line to the Dynamic Extensions section of the php.ini file to load the SQL Anywhere PHP driver automatically.
where 5.x.y reflects the version number of the SQL Anywhere PHP module copied in the previous step.
An alternative to automatically loading the PHP driver is to load it manually in each script that requires it. See Configuring the SQL Anywhere PHP module.
Make sure that the Bin32 subdirectory of your SQL Anywhere installation is in your path. The SQL Anywhere PHP extension DLL requires the Bin32 directory to be in your path.
At a command prompt, enter the following command to start the SQL Anywhere sample database.
The command starts a database server using the sample database.
At a command prompt, change to the SDK\PHP\Examples subdirectory of your SQL Anywhere installation, and enter the following command:
Messages similar to the following should appear. If the PHP command is not recognized, verify that PHP is in your path.
Installation successful Using php-5.2.6_sqlanywhere.dll Connected successfully
If the SQL Anywhere PHP driver does not load, you can use the command "php -i" for helpful information about your PHP setup. Search for extension_dir and sqlanywhere in the output from this command.
When you are done, stop the SQL Anywhere database server by clicking Shut Down in the database server messages window.
For more information, see Creating PHP test pages.
|Send feedback about this page via email or DocCommentXchange||Copyright © 2008, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.0|