Requirements & Background
Recently, according to the project requirements, to remotely connect the Oracel 11g Express database in PHP, for ease of development, decided to use PDO, that is, PHP pdo_oci extension, but PHP installation did not install the pdo_oci extension, So now you need to add a php extension.
Solution Solutions
First Google search for a bit, found a piece of article: http://shiki.me/blog/installing-pdo_oci-and-oci8-php-extensions-on-centos-6-4-64bit/, This article is very detailed, thank the author very much!
Let me summarize briefly here:
The first thing to install the Oracle database is instantclient:: http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html. Depending on your system, select the appropriate installation package, basic and devel two packages are required to install. Because the Oracle 11g Express database is not installed on my server, it needs to be installed and if the Oracle 11g Express database is already mounted on the server, this step should be negligible (just a guess, no test)
Download the PDO_OCI source package (Https://pecl.php.net/package/PDO_OCI) from pear, select the stable version of 1.0, you can download directly to Linux using wget, or use the PECL command (recommended):
tar -xvf pdo_oci-1.0. tgz$ cd pdo_oci-1.0
Because pdo_oci this extension has not been updated for a long time, need to edit config.m4 this file to support 11g or higher database, as follows:
Add the following code around line 10th:
elif test-f $PDO _oci_dir/lib/libclntsh. $SHLIB _suffix_name. 11.2 Then pdo_oci_version=11.2
Add the following code around 101 lines:
11.2 ) 1, pdo_oci_shared_libadd) ;;
Then it was compiled and installed with the Phpize tool:
// If the system prompts you not to find this command, simply install Php-devel // $ yum Install php-devel$./configure--with-pdo-oci=instantclient,/usr,11.2 make sudo makeinstall
I get an error after I run the./configure--with-pdo-oci=instantclient,/usr,11.2: Checking for oci.h ... configure:error:i ' m too dumb t o figure out where the include Dir was in your instant client install means that the instant client's include folder was not found, why is this? Continue Google, this problem is rare, I spent a lot of time on this issue. At last, I see a comment under a piece of article:
Changes for x86_64 November 10th @ 09:11 am Some changes were required to get the Configure to work On a A-bit Redhat (Fedora) system.
We installed the. version of Oracle-instantclient-{devel,basic}.
These installed in:
/usr/lib/oracle/11.2/client64
/usr/include/oracle/11.2/client64
We created Symlinks as follows:
/usr/lib/oracle/11.2/client,/usr/lib/oracle/11.2/client64
/usr/include/oracle /11.2/client,/usr/include/oracle/11.2/client64
then the "./configure--with-pdo-oci=instantclient,/usr , 11.2 "Command worked fine!
The reason for the symlinks instead of changing the variables in the oracle.sh are that the build/configure scrip TS seem to is hard coded for "client" (not Client64) in many places. It was easer to create 2 symlinks than to change all the code in every Script/config file.
Thank you very much for asking the netizen. It probably means that the folders you look for in configure are/usr/lib/oracle/11.2/client and/usr/include/oracle/11.2/client, and the two folder locations are composed of: ${prefix}/ Lib OR lib/oracle/${version}/client, and 64bit of the instant Client installation directory is Client64, so configure can not find, to solve this problem only need to add two symbolic Links:
Ln -s/usr/lib/oracle/11.2/client64/usr/lib/oracle/11.2/ln -s/usr/ include/oracle/11.2/client64/usr/include/oracle/11.2/client
Once you have added the symbolic link, do it again.
$./configure--with-pdo-oci=instantclient,/usr,11.2makesudo makeInstall
Successful execution, no error.
After the make install succeeds, the pdo_oci.so appears in/usr/lib64/php/modules/and then activates the pdo_oci extension in the PHP configuration file:
VI /etc/php.d/pdo_oci.ini
Added content: extension=pdo_oci.so
Restart Apache to use the pdo_oci extension.
This article copyright belongs to the author, reproduced please indicate the source: http://www.cnblogs.com/jpdoutop/p/Install-PDO_OCI-extension-On-Linux-64bit.html
Install PHP pdo_oci Extension Installing pdo_oci extension on CentOS 6.7 64bit in CentOS 6.7 64-bit