This article carefully describes the specific way to connect oracle8i with PHP4 in a Linux environment.
1. Download and install Oracle 8i for Linux. Complete installation, do not install the client only.
2. Download PHP3 or PHP4 source code.
3. Configure the PHP installation parameters:
for PHP 4:./configure with-apxs=/usr/sbin/apxsprefix=/usrwith-gdenable-versioningwith-mysql=/usrwith-oracle=/usr/ local/oracle/8i/u01/app/oracle/product/8.1.5with-oci8=/usr/local/oracle/8i/u01/app/oracle/product/ 8.1.5with-zlibwith-dbasewith-fileprowith-config-file-path=/etc/httpd/confwith-fdftk=noenable-debug= noenable-magic-quotesenable-debuggerenable-bcmathenable-track-varsenable-safe-modewith-exec-dir=/usr/ Binwith-system-regexno-createno-recursion
The with-oracle option allows PHP to access Oracle 7.x or 8.x via the Ora_ function.
The WITH-OCI8 option allows PHP to use more and better oci8 functions.
4. Make.
5. Make install.
6. CP./php.ini-dist/wherever/your/conf/files/are/php.ini copies the php.ini to the appropriate location.
7. Modification of httpd.conf, such as LoadModule Php4_module lib/apache/libphp4.so, to read: LoadModule php4_module/usr/lib/apache/ Libphp4.so.
8. Restart Apache.
9. Test whether the installation of PHP4 is successful. Create a TEST.PHP3 content: access it in the browser to see if there is Oracle and ORACLE8 information. If there is, then it succeeds.
10. Now start using the Oracle function:
<?//set ORACLE environment variable putenv ("Oracle_sid=prod");p utenv ("oracle_home=/usr/local/oracle/8i/u01/app/oracle/product/ 8.1.5 ")//Create connection//modify current USER_ID,PASSWORD,DB to suit your configuration if ($conn = Ocilogon (" user_id "," Password "," db ")) {//Get information about the database printf ( "%s</p>", Ociserverversion ($conn)); else{printf ("Conncetion Failed"); >
This program will show some information about Oracle that you are connected to.
12. Other:
If you need to connect to a remote Oracle server, you will also need to set up your Sqlnet.ora and Tnsnames.ora to specify the location of the remote database. Ask the database administrator to copy some files to the $oracle_home/network/admin/directory.