Installation steps:
I. Installation of oracle-instantclient
Download Address: http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html
Download oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpm
Download
oracle-instantclient11.2-devel-11.2.0.4.0-1.x86_64.rpm
Put it in the/usr/packages/directory.
# RMP-IVH oracle-instantclient*
The/usr/lib/oracle/11.2/client/lib/directory is generated at this time
* Note: Download the corresponding database version
Ii. Modify the/etc/ld.so.conf configuration file
Append content:
/usr/lib/oracle/11.2/client/lib/
Execute Command # Ldconfig
Iii. installation of Oci8
Download the latest OCI8 components
Download Address: Http://pecl.php.net/package/oci8
Download oci-2.0.8.tgz
Put it in the/usr/packages/directory.
# TAR-XVZF oci-2.0.8.tgz
# cd oci-2.0.8 #
/usr/local/php/bin/phpize (phpize configuration file is generated with configure)
#./ Configure--with-php-config=/usr/local/php/bin/php-config--WITH-OCI8=SHARED,INSTANTCLIENT,/USR/LIB/ORACLE/11.2/ Client/lib
# make && make install
Success will tell you that oci8.so has been successfully placed in the following directory
Iv. Configuring PHP Support OCI Extensions
Modify PHP configuration file
# Vi/usr/local/php/lib/php.ini File
Append the following after the extension item
Extension=oci8.so
Restart the Apache service test
# apachectl Restart
Use the probe function phpinfo () to see if the extension is open, if the following illustration shows that the extension opens
VI. Testing Database connections
Writing oracle.php in the site root directory
The code is as follows:
<?php
$conn = Ocilogon (' Test ', ' Test ', ' 192.168.23.131:1521/dev ');
if (! $conn)
{
$Error = Oci_error ();
Print htmlentities ($Error [' message ']);
Exit;
}
else
{
echo "Connected Oracle successd!".) <br> ";
Ocilogoff ($conn);
>
Browser address bar Input http://192.168.1.131/oracle.php
Description: 192.168.1.131 is the server address, direct point to the server Apache site and directory.
Display Connected Oracle successd! indicates a successful database connection.