Recently, I’ve had issues getting the install of OCI8 using other methods as described in my articles Installing OCI8 & PHP 7.2 on RHEL or CentOS 6 and Installing OCI8 on RHEL. This article covers installing as a “Shared Extension” as described in The Underground PHP and Oracle Manual.
Below are the steps that I followed:
# Stop Apache and uninstall old versions of OCI8. $ service httpd stop $ pecl uninstall oci8 $ sudo yum install php-pear php-devel $ pear download pecl/oci8 # The next commands depend on the version of oci8 downloaded above. $ tar xvzf oci8-2.2.0.tgz $ cd oci8-2.2.0/ $ phpize $ export PHP_DTRACE=yes # make sure of the instantclient path below... mine was version 18.3 so it was located in this folder... Also make note some tutorials ask for the ORACLE_HOME folder which theoretically is /usr/lib/oracle/18.3/client64 but if its instantclient then put the lib folder underneath it (worked for me at least:) $ ./configure --with-oci8=instantclient,/usr/lib/oracle/12.2/client64/lib/ $ make $ make install # NOW an .so file built in: /usr/lib64/php/modules/oci8.so # THIS STEP NOT NEEDED if SELinux disabled on your server/box, but if SELinux is enabled run: setsebool -P httpd_execmem 1 # NOW add: extension=oci8.so at the bottom of your php.ini file (probably in /etc/php.ini) # Add extension_dir=/usr/lib64/php/modules/ $ sudo service httpd restart
After performing the install you should verify on the phpinfo() page by searching for “oci8” and verify the section shown in the screenshot below appears. Then you are done.