PHP oci8 won't install through pecl: "fatal error: oci8_dtrace_gen.h"

BidonPython picture BidonPython · May 24, 2017 · Viewed 14.6k times · Source

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!

Answer

Christopher Jones picture Christopher Jones · May 30, 2017

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:

$ export PHP_DTRACE=yes
$ pecl install oci8

This is mentioned in http://php.net/manual/en/oci8.dtrace.php