简体   繁体   中英

error: oci.h: No such file or directory

I'm trying to install oci8-1.4.9 in Centos 5.11 under oracle 11 and php5.3, but I'm getting errors when I use

pecl install oci8-1.4.9

The error

 config.status: creating config.h
running: make
/bin/sh /var/tmp/pear-build-root/oci8-1.4.9/libtool --mode=compile gcc  -I. -I/tmp/tmp9GRxQr/oci8-1.4.9 -DPHP_ATOM_INC -I/var/tmp/pear-build-root/oci8-1.4.9/include -I/var/tmp/pear-build-root/oci8-1.4.9/main -I/tmp/tmp9GRxQr/oci8-1.4.9 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext  -DHAVE_CONFIG_H  -g -O2   -c /tmp/tmp9GRxQr/oci8-1.4.9/oci8.c -o oci8.lo
mkdir .libs
 gcc -I. -I/tmp/tmp9GRxQr/oci8-1.4.9 -DPHP_ATOM_INC -I/var/tmp/pear-build-root/oci8-1.4.9/include -I/var/tmp/pear-build-root/oci8-1.4.9/main -I/tmp/tmp9GRxQr/oci8-1.4.9 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -DHAVE_CONFIG_H -g -O2 -c /tmp/tmp9GRxQr/oci8-1.4.9/oci8.c  -fPIC -DPIC -o .libs/oci8.o
In file included from /tmp/tmp9GRxQr/oci8-1.4.9/oci8.c:58:
/tmp/tmp9GRxQr/oci8-1.4.9/php_oci8_int.h:56:17: error: oci.h: No such file or directory
In file included from /tmp/tmp9GRxQr/oci8-1.4.9/oci8.c:58:
/tmp/tmp9GRxQr/oci8-1.4.9/php_oci8_int.h:113: error: expected specifier-qualifier-list before 'OCIEnv'
/tmp/tmp9GRxQr/oci8-1.4.9/php_oci8_int.h:122: error: expected specifier-qualifier-list before 'OCIEnv'
/tmp/tmp9GRxQr/oci8-1.4.9/php_oci8_int.h:152: error: expected specifier-qualifier-list before 'dvoid'

....

/tmp/tmp9GRxQr/oci8-1.4.9/oci8.c:3309: error: 'php_oci_spool' has no member named 'spool_hash_key'
/tmp/tmp9GRxQr/oci8-1.4.9/oci8.c: At top level:
/tmp/tmp9GRxQr/oci8-1.4.9/oci8.c:3321: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'php_oci_ping_init'
make: *** [oci8.lo] Error 1
ERROR: `make' failed

How can I fix it?

I have had a similar problem on Ubuntu 14.04 LTS and the OCI extension.

I installed the Oracle Instant Client via the 'alien' toolkit and set the LD-library path and ORACLE_HOME Environment. The command sqlplus is working and I can access the oracle database.

The installation of the OCI PHP/PECL Interface didn't worked out of the box. The library and binaries are in the directory '/usr/lib/oracle/12.1/client64' and the include header are located under '/usr/include/oracle/12.1/client64'

In file included from /tmp/pear/temp/oci8/oci8.c:48:0:
/tmp/pear/temp/oci8/php_oci8_int.h:60:17: fatal error: oci.h: No such file or directory
 #include <oci.h>

We have to get the include path through pecl with the compiler environment

 C_INCLUDE_PATH=/usr/include/oracle/12.1/client64 pecl install oci8-2.0.12

Now the pecl installation worked :) I hope it will be the same problem on CentOS.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM