PHP4 method connection Oracle 8i

xiaoxiao2021-03-05  22

1. Download and install Oracle 8i for Linux.

Install, don't just install the client

Download Location: Hot Download of 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 the installation parameters of PHP

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 an ORA_ function

--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

Copy php.ini to the appropriate location

7. Modify httpd.conf

Modify this line

LoadModule PHP4_Module Lib / Apache / Libphp4.so

Change to:

LoadModule PHP4_Module /usR/LIB/apache/libphp4.so

8. Restart Apache

9. Test if the installation of PHP4 is successful

Create a Test.php3 content:

Access it in your browser to see if there is Oracle and Oracle8 information.

If there is, then congratulations!

10. Now use Oracle's function.

// Set an Oracle environment variable

Putenv ("Oracle_SID = Prod");

Putenv ("Oracle_Home = / usr / local / oracle / 8i / u01 / app / oracle / product / 8.1.5");

// establish connection

/ / Modify the current User_ID, Password, DB to accommodate your configuration

IF ($ conn = Ocilogon ("User_ID", "Password", "DB"))

{

// obtain the information of the database

Printf ("% s ", OCISERVERVERSON ($ conn));

}

Else

{

Printf ("Conncetion Failed");

}

?>

This program will display some information about Oracle you are connected 12. Others

If you need to connect to a remote Oracle server, you also need to set your SQLNET.ORA and TNSNAMES.ORA to specify the location of the remote database.

To the database administrator, copy some files to

$ Oracle_home / network / admin / directory

转载请注明原文地址:https://www.9cbs.com/read-32386.html

New Post(0)