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.
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 from the Bin32 subdirectory of your SQL Anywhere installation to the directory specified by the extension_dir entry in the php.ini file.
The string 5.x.y is the PHP version number corresponding to the version that you have installed.
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. Note that a version 5.2.x SQL Anywhere PHP module will not work with a version 5.3.x PHP.
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.
Save and close php.ini.
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, run 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. Make sure that the php executable directory is included in your path. 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.
|Envoyer votre avis sur cette page par email.||Copyright © 2009, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.1|