Solutions
Development packages
# yum install php-pear php-devel zlib zlib-devel bc libaio glibc
# yum groupinstall "Development Tools"
Instant Client
1. Download the Basic and the SDK Instant Client packages from the OTN Instant Client page.
Install the RPMs as the root user, for example:
- Latest Client 21.5.0.0.0 with Oracle 12c and PHP 8.1.
- Before that Instant Client 21.3.0.0.0 with Oracle 12c and compiled with PHP 8.0, 7.4 and 7.3 fine.
- Before that Instant Client 10.1.0.5.0 with Oracle 10g, 11g and 12c and PHP 5.6, 7.1, 7.2, 7.3 and 7.4.
2. Install Basic and the SDK Instant Client packages
#rpm -Uvh oracle-instantclient-XXX.rpm
#rpm -Uvhoracle-instantclient-devel-XXX.rpm
3.Check you have php-pear and php-devel packages installed by this command
# rpm -qa | grep -i php
.....
php-5.3.3-3.el6_1.3.x86_64
php-cli-5.3.3-3.el6_1.3.x86_64
.....
OCI8
4.Install oci8 extension by manual or auto
Manual
# pear download pecl/oci8
# tar -xvf oci8-version.tgz
# cd oci8-version
Build and install the extension.
# phpize
# ./configure --with-oci8=shared,instantclient,/usr/lib/oracle/<exact path>
# make
# make install
* If got an error when to make
compilation terminated.
make: *** [oci8.lo] Error 1
ERROR: `make' failed
It seems that your PHP was built with DTrace support enabled.
# export PHP_DTRACE=yes
# pecl install oci8
Auto
# pecl search oci8
# pecl install oci8
- Use
pecl install oci8
to install for PHP 8.2. - Use
pecl install oci8-3.2.1
to install for PHP 8.1. - Use
pecl install oci8-3.0.1
to install for PHP 8.0. - Use
pecl install oci8-2.2.0
to install for PHP 7
OR
# yum install php56-php-oci8-5.6.40-25.el7.remi.x86_64 - PHP56
# yum install php-oci8-7.3.27-1.el7.remi.x86_64 - PHP7
5. Enable oci8 extension
To enable the extension, add a file named oci8.ini in /etc/php.d/ with this content:
# extension=oci8.so
6. Restart http server
#/etc/init.d/httpd restart
7. Validate that it was successfully installed.
# php -i | grep oci8
You can check that the extension is installed with:
# php --ri oci8
8. Uninstall
# pecl uninstall oci8
Source :
https://github.com/php/pecl-database-oci8
http://www.techinfobest.com/connect-oracle-database-from-php-in-redhatcentos
http://www.oracle.com/technetwork/articles/dsl/technote-php-instant-084410.html
http://itvomit.com/2013/10/25/getting-oracle-instant-client-php-and-oci8-all-working/
0 comments:
Post a Comment