[Centos] install PHP OCI8 extension
Installing the extension to connect to oracle database on CentOS server.
In the command lines can be specified word <VERSION> – please replace the with version number.
This solution assumed installed apache and php on the server.
We can download packages from oracle sites (http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html)
We will download RPM for this packages:
1 2 |
oracle-instantclient11.2-basic-<VERSION>. x86_64.rpm instantclient11.2-oracle-devel-<VERSION>. x86_64.rpm |
And we can install this on server:
1 2 |
rpm-Uvh oracle-instantclient11.2-basic-<VERSION>. x86_64.rpm rpm-Uvh oracle-instantclient11.2-devel-<VERSION>. x86_64.rpm |
If everything went ok, we can write to the configuration file:
1 |
echo /usr/include/oracle/<VERSION>/client/lib/ > <br />/etc/ld.so.conf.d/oracle_client.conf |
Now we can run, and check the VERSION:
1 |
ldconfig-v |
Install OCI8 (download and compilation)
Now we need the OCI8 extension. It can be downloaded from the web pecl.php (http://pecl.php.net/package/oci8) and unpack on disk drive.
1 2 |
tar -xzvf oci-<VERSION>.tgz cd oci-<VERSION> |
We can switch to package folder and run:
1 |
phpize |
If we find that it is not supported in the system, you can install:
1 |
yum -y install php-devel |
and start again
1 |
phpize |
then run:
1 |
configure -with-oci8=shared,instantclient,<br />/usr/lib/oracle/11.2/client64/lib/ |
which we will configure and run
1 2 |
make make install |
Unless the system compiler, install the GCC:
1 |
yum install gcc |
Install OCI8 (pecl install)
The second option is to install with PECL:
1 |
pecl install oci8 |
and write the configuration:
1 |
echo extension=oci8.so > /etc/php.d/oci8.ini |
restart apache server:
1 |
/etc/init.d/httpd restart |