install oracle lib on your server
# rpm -Uvh oracle-instantclient12.1-basic-12.1.0.1.0-1.x86_64.rpm
# rpm -Uvh oracle-instantclient12.1-devel-12.1.0.1.0-1.x86_64.rpm
then run this command to install oci8
pecl install oci8
Enable the PHP OCI8 extension by create/editing /etc/php.d/oci8.ini
extension=oci8.so
then restart httpd service by :
systemctl restart httpd
and now you can check via phpinfo from browser or via command with like this screenshot :
and yeah as simple as that ^_^
.:-TroubleShoot-:.
--Error 1--
running: make
/bin/sh /var/tmp/pear-build-root8YDCsA/oci8-2.2.0/libtool --mode=compile cc -I. -I/var/tmp/oci8 -DPHP_ATOM_INC -I/var/tmp/pear-build-root8YDCsA/oci8-2.2.0/include -I/var/tmp/pear-build-root8YDCsA/oci8-2.2.0/main -I/var/tmp/oci8 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/include/oracle/12.1/client64 -DHAVE_CONFIG_H -g -O2 -c /var/tmp/oci8/oci8.c -o oci8.lo
libtool: compile: cc -I. -I/var/tmp/oci8 -DPHP_ATOM_INC -I/var/tmp/pear-build-root8YDCsA/oci8-2.2.0/include -I/var/tmp/pear-build-root8YDCsA/oci8-2.2.0/main -I/var/tmp/oci8 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/include/oracle/12.1/client64 -DHAVE_CONFIG_H -g -O2 -c /var/tmp/oci8/oci8.c -fPIC -DPIC -o .libs/oci8.o
In file included from /var/tmp/oci8/oci8.c:49:0:
/var/tmp/oci8/php_oci8_int.h:46:29: fatal error: oci8_dtrace_gen.h: No such file or directory
#include "oci8_dtrace_gen.h"
^
compilation terminated.
make: *** [oci8.lo] Error 1
ERROR: `make' failed
---Solusion--
[root@localhost mnt]# export PHP_DTRACE=yes
--Error 2--
configure: error: Cannot find sys/sdt.h which is required for DTrace support
ERROR: `/var/tmp/oci8/configure --with-php-config=/usr/bin/php-config --with-oci8' failed
--Solusion--
install this package
[root@localhost mnt]# yum install systemtap-sdt-devel
3 comments
Click here for commentsHello!
ReplyI have installed oracle 12c enterprise on a fresh centos 8 server installation. I want to connect oracle to laravel. I have installed php 7.2 and I must install oci8. I followed your guide but I failed to make it work. I followed some other guides too and now I will reinstall my system from scratch since I have messed it up. Meanwhile could you please guide me for centos 8? What instant client version should I download? And what steps should I follow?
Thank you!
Thank you, it helped me
Replyfor php 7 try to use : " pecl install oci8-2.2.0 "
Replycomment please ... ConversionConversion EmoticonEmoticon