php method for connecting to Oracle Database (successful test), Oracle Database
This article simply analyzes how PHP connects to Oracle database. Share to everyone for your reference, as follows:
PHP provides two sets of functions to connect with Oracle, namely the Ora_ and OCI functions. Where the Ora_ function is slightly stale. The OCI function update is said to be better. The use of the two grammars is almost the same. Your PHP installation options should be able to support the use of both.
Because the OCI function accesses Oracle8 above the database needs to use the Oracle8 call-interface (OCI8), this expansion module needs the Oracle8 client function library, therefore needs to connect the remote database, also needs the connection side installs the Oracle client software , can go to http://www.oracle.com free download, this is necessary, otherwise it will be reported that the method is not defined incorrectly.
Steps:
1, install Apache and PHP.
2. Install Oracle 10g Instant Client (or other version).
2. Open the Extension=php_oci8 extension in php.ini.
3. Copy the Php_oci8.dll file under the Php/ext directory to the system32 directory.
4, write test script test.
<?php$conn = Oci_connect (' User name ', ' Password ', ' Remote Database name (EG.//192.168.1.133/ORCL) '), if (! $conn) { $e = Oci_error (); Print htmlentities ($e [' message ']); Exit;} else { echo "connects Oracle successfully! ";}? >
Errors that may occur:
1, call to undefined function oci_connect () ...: This is because Php_oci8.dll is not found, check Apache error log error.log may see: PHP startup:unable To load dynamic liberaries Php_oci8.dll ...
Workaround: Copy the Php_oci8.dll file under the Php/ext directory to the System32 directory, and if not, add the Oracle 10g Instant Client Installation directory/product/10.2.0/db_2/ The Oci.dll file in the bin directory is copied to system32.
2, Ocienvnlscreate () failed .... PATH includes the directory with Oracle Instant Client libraries
Workaround: Restart the machine and, if not, install the Oracle 10g Instant Client.
More interested in PHP related content readers can view this site topic: "PHP based on PDO operation database Tips Summary", "PHP+MONGODB Database operation Skills Daquan", "PHP Object-oriented Programming tutorial", "PHP String Usage Summary", " Php+mysql database Operation Tutorial "and" PHP common database Operation Skills Summary "
I hope this article is helpful to you in PHP programming.
http://www.bkjia.com/PHPjc/1133082.html www.bkjia.com true http://www.bkjia.com/PHPjc/1133082.html techarticle how PHP connects to Oracle Database (successful test), Oracle database This article simply analyzes how PHP connects to the Oracle database. Share to everyone for reference, as follows: PHP provides ...