This is the way can use to install PHP module extension OCI8 (Oracle) on Centos 6/7 with LAMPP or XAMPP Linux. For the first thing you will need install these prerequisites :
yum install php-pear yum install php-devel
INSTALL RPM PACKAGES
And you will have to download both of RPM Packages from Oracle Instant Client Download :
This one contains additional header files and an example “makefile” for developing Oracle applications with Instant Client.
This one contains files required to run OCI, OCCI, and JDBC-OCI applications.
notes : The XXX are for oracle instant client version and your platform, choose as you need.
I recommend you to place those files into same folder, and then install those file using rpm command. You need these files for import libraries. You can install by this command below :
rpm -ivh instantclientXXX-basic-xxx.rpm rpm -ivh instantclientXXX-devel-xxx.rpm
DOWNLOAD & INSTALL OCI8
PHP OCI8 extension from PECL is always with the current version. It’s important for you before installing OCI8, you have to check your PHP version in your server. You can check your PHP version by this command below :
And then you need to install OCI8 by this command :
// for PHP 7 or later use this pecl install oci8 // for PHP 5.2 until PHP 5.6 use this pecl install oci8-2.0.12 // for PHP 4.3.9 - PHP 5.1 use this pecl install oci8-1.4.10
For more information about pecl oci8 installation you can check out from PECL PHP Packages here.
Wait for the download and installation process and may you observe the output carefully, make sure no errors. In installing process you will need to fill a config for your Oracle Client Library Path.
In my server it placed in
/usr/lib/oracle/11.2/client64/lib/. You have to check your own path.
Well If any errors are shown, you have to review what the error said, just make sure you haven’t missed anything steps above. When oci8 is successfully installed, you now need to edit the php.ini config file to add the compiled oci8.so (OCI8 Extension File) file :
Add this code into your end of line in your php.ini
Once you have add that code in your php.ini, the last step is restart your lampp server with this script.
And now check your phpinfo(). If your oci8 installed you will se like this one.