Home > Backend Development > PHP Problem > How to install pdo_oci extension in php7

How to install pdo_oci extension in php7

王林
Release: 2023-03-08 13:34:02
Original
3385 people have browsed it

How to install the pdo_oci extension in php7: 1. Download and install the oracle client on the official website; 2. Enter the source code installation package of php and execute [/usr/local/php/bin/phpize]; 3. Execute [make install] command can be installed.

How to install pdo_oci extension in php7

The operating environment of this article: centos 7 system, php7, thinkpad t480 computer.

Premise:

There are related environments on the CentOS server: apache2, php7

Need to install: 1.oracle client, 2.oci8 extension, 3.pdo_oci extension

1. Install Oracle client

Oracle client can be downloaded from Oracle official website

How to install pdo_oci extension in php7

Select the two installation packages above and download Go to /usr/local/src and decompress:

unzip instantclient-basic-linux.x64-11.2.0.4.0.zip
unzip instantclient-sdk-linux.x64-11.2.0.4.0.zip
Copy after login

Then enter the decompressed directory: cd instantclient_11_2/Connect the following three files

ln -s libnnz11.so libnnz.so
ln -s libclntsh.so.11.1 libclntsh.so
ln -s libocci.so.11.1 libocci.so
Copy after login

Then enter the decompressed directory Move to the /usr/local/lib directory and rename it to 'instantclient'

mv ./instantclient_11_2   /usr/local/lib/instantclient
Copy after login

(Learning video sharing: php video tutorial)

2. Install oci8 Extension

Enter the source code installation package of PHP: cd /usr/local/src/php-7.1.25/ext/oci8/

Execute /usr/local/php/bin/phpize

Then execute:

./configure --with-php-config=/usr/local/php/bin/php-config --with-oci8=shared,instantclient,/usr/local/lib/instantclient
Copy after login

Then execute make

Finally make install

Enter cd /usr/local/php/lib/php/extensions/no- debug-zts-20160303/Checking the file oci8.so indicates that the installation is successful

The next step is to add extension=oci8.so in the php.ini configuration

3. Install the pdo_oci extension

Enter the source code installation package of php: cd /usr/local/src/php-7.1.25/ext/pdo_oci

Execute /usr/local/php/bin/phpize

Then execute: ./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-oci=instantclient,/usr/local/lib/instantclient

Then execute make

Finally make install

Enter cd /usr/local/php/lib/php/extensions/no-debug-zts-20160303/ to view the file pdo_oci.so Indicates that the installation is successful

The next step is to add extension=pdo_oci.so in the php.ini configuration

Check phpinfo and if there is oci8 and pdo_oci, the addition is successful

Related Recommended: php tutorial

The above is the detailed content of How to install pdo_oci extension in php7. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template