The following instructions apply to all configurations.
To test whether PHP is set up properly, the following procedure describes how to create and run a web page that calls phpinfo. The PHP function, phpinfo, generates a page of system setup information. The output tells you whether PHP is working properly.
For information about installing PHP, see http://us2.php.net/install.
Create a file in your root web content directory named info.php.
If you are not sure which directory to use, check your web server's configuration file. In Apache installations, the content directory is often called htdocs. If you are using Mac OS X, the web content directory name may depend on which account you are using:
If you are the System Administrator on a Mac OS X system, use /Library/WebServer/Documents.
If you are a Mac OS X user, place the file in /Users/your-user-name/Sites/.
Insert the following code into this file:
<?php phpinfo(); ?>
This confirms that your installation of PHP and your web server are working together properly.
At a command prompt, run the following command to start the SQL Anywhere sample database (if you have not already done so):
To test that PHP and your web server are working correctly with SQL Anywhere:
Copy the file connect.php from the sdk\php\examples directory to your root web content directory.
From a web browser, access the connect.php page.
Connected successfully should appear.
Create a file containing the following PHP code in your root web content directory named sa_test.php.
<?php $conn = sasql_connect( "UID=DBA;PWD=sql" ); $result = sasql_query( $conn, "SELECT * FROM Employees" ); sasql_result_all( $result ); sasql_free_result( $result ); sasql_disconnect( $conn ); ?>
Discuss this page in DocCommentXchange.
|Copyright © 2012, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.1|