I am trying to connect my fedora 25 webserver - php to Oracle db.
To do this I need to pecl install oci8.
However I get this error:
/bin/sh /var/tmp/pear-build-roottqYEC6/oci8-2.1.4/libtool --mode=compile cc -I. -I/var/tmp/oci8 -DPHP_ATOM_INC -I/var/tmp/pear-build-roottqYEC6/oci8-2.1.4/include -I/var/tmp/pear-build-roottqYEC6/oci8-2.1.4/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-roottqYEC6/oci8-2.1.4/include -I/var/tmp/pear-build-roottqYEC6/oci8-2.1.4/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.
Makefile:196: recipe for target 'oci8.lo' failed
make: *** [oci8.lo] Error 1
ERROR: `make' failed
I do not know what to do. I've searched everywhere for a solution, and I can only find outdated articles.
Any help much appreciated!
It seems that your PHP was built with DTrace support enabled. Due to some limitations with the PHP build & config files, the PECL OCI8 install needs a hint to also build with DTrace:
This is mentioned in http://php.net/manual/en/oci8.dtrace.php
Note: I got the same oci8_dtrace_gen.h but 'sudo yum install systemtap-sdt-devel && export PHP_DTRACE=yes && pecl install oci8' didnt help (added the systemtap-stp-devel step as comment below reminded me I did read in some article that I had to install it for DTRACE ).
I had to manually build which some articles recommended:
and afterwards, you may want to check your phpinfo() output to make sure apache has access to ORACLE_HOME, TNS_ADMIN, LD_LIBRARY_PATH vars in its Environment section (i defined these in /etc/sysconfig/httpd).
Then you can test OCI with a simple script like this... I put various connection string formats which worked for me that you can uncomment and test (some dependent on EZCONNECT style or assuming you have TNS_ADMIN setup correctly. 1st uncommented $db one is the easiest):