Home >Backend Development >PHP Problem >How to install pdo-oci extension in linux php

How to install pdo-oci extension in linux php

藏色散人
藏色散人Original
2021-10-20 10:33:322401browse

How to install the pdo-oci extension in linux php: 1. Install the Oracle client; 2. Enter the php source code installation package and execute make; 3. Add "extension=pdo_oci." to the php.ini configuration. so" can be done.

How to install pdo-oci extension in linux php

The operating environment of this article: linux5.9.8 system, php version 7.1.25, DELL G3 computer

How to install pdo in linux php -oci extension?

Installing php extensions pdo_oci and oci8 under Linux:

This installation of the extension took me most of the day, and I hereby record the details As for the installation process, I hope this tutorial can help everyone and avoid detours during the installation process.

There are related environments on the CentOS server: apache2, php7
Need to install: 1.oracle client, 2.oci8 extension, 3.pdo_oci extension

1. Installation Oracle client

Oracle client can be downloaded from the oracle official website (https://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html)

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

 unzip instantclient-basic-linux.x64-11.2.0.4.0.zip
  unzip instantclient-sdk-linux.x64-11.2.0.4.0.zip

Then enter the decompressed directory: cd instantclient_11_2/Put the following three Make a connection with the files

ln -s libnnz11.so libnnz.so
ln -s libclntsh.so.11.1 libclntsh.so
ln -s libocci.so.11.1 libocci.so

Then move the decompressed directory to the /usr/local/lib directory and rename it to 'instantclient' mv ./instantclient_11_2 /usr/local /lib/instantclient

2. Install the 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

and then execute: ./configure --with-php-config=/usr/local/php/ bin/php-config --with-oci8=shared,instantclient,/usr/local/lib/instantclient

Then execute make

Finally make install

Enter cd /usr/local/php/lib/php/extensions/no-debug-zts-20160303/ Check that the file oci8.so is installed, indicating 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/ and check that the file pdo_oci.so is installed successfully.

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

Check phpinfo. If there are oci8 and pdo_oci, the addition is successful

## Recommended learning: "

PHP Video Tutorial"

The above is the detailed content of How to install pdo-oci extension in linux php. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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