How to connect PHP4 to Oracle 8i (translation)
sonymusic March 30, 2000
Email it to me and I will talk about my views Previous article Next article
1. Download and install Oracle 8i for linux.
Full installation, don’t just install the client
Download location: hot download at chat.hn.cninfo.net/soft
2. Download PHP3 or PHP4 source code
Download location: www.php.net www.phpuser.com chat.hn.cninfo.net/soft
3. Configure PHP installation parameters
for php 4:
./configure --with-apxs=/usr/sbin/apxs
--prefix=/usr
--with-gd
--enable-versioning
--with-mysql =/usr
--with-oracle=/usr/local/oracle/8i/u01/app/oracle/product/8.1.5
--with-oci8=/usr/local/oracle/8i/ u01/app/oracle/product/8.1.5
--with-zlib
--with-dbase
--with-filepro
--with-config-file-path=/etc /httpd/conf
--with-fdftk=no
--enable-debug=no
--enable-magic-quotes
--enable-debugger
--enable-bcmath
--enable-track-vars
--enable-safe-mode
--with-exec-dir=/usr/bin
--with-system-regex
--no-create
--no-recursion
--with-oracle option allows PHP to access Oracle 7.x or 8.x through ORA_ function
--with-oci8 option Let PHP use more and better oci8 functions
4. make
5. make install
6. cp ./php.ini-dist /wherever/your /conf/files/are/php.ini
Copy php.ini to the appropriate location
7. Modify httpd.conf
Modify the following line
LoadModule php4_module lib/apache/ libphp4.so
is changed to:
LoadModule php4_module /usr/lib/apache/libphp4.so
8. Restart APACHE
9. Test whether the installation of PHP4 is successful
Create a test.php3 with the content:
phpinfo(); ?>
Access it in the browser to see if there is ORACLE and ORACLE8 information.
If so, congratulations!
10. Now start using ORACLE functions
// Set ORACLE environment variables
putenv("ORACLE_SID=PROD");
putenv("ORACLE_HOME=/ usr/local/oracle/8i/u01/app/oracle/product/8.1.5");
// Establish a connection
// Modify the current user_id, password, db to suit your configuration
if($conn = OCILogon("user_id","password","db"))
{
// Get database information
printf("%s
", OCIServerVersion ($conn));
}
else
{
printf("Conncetion Failed");
}
?>
This program will display the connection you are connected to Get some information about ORACLE
12. Others
If you need to connect to a remote ORACLE server, you 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 and put them in the
$ORACLE_HOME/network/admin/ directory
http://www.bkjia.com/PHPjc/532011.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/532011.htmlTechArticleHow to connect Oracle 8i with PHP4 (translation) sonymusic March 30, 2000 Email it to me and I will talk about it Talk about my opinion Previous articleNext article 1. Download and install Oracle 8i for linux. Complete installation...