繁体   English   中英

安装 OCI8 PHP 7.0 错误

[英]Installing OCI8 PHP 7.0 Error

感谢您阅读我的问题。 我在我的 Windows 环境中开发了一个 PHP 7 应用程序,其中包含 oracle 数据库。 现在我需要在 Linux 环境中发布。 我不是 env 专家,我在这个 env 配置中花了几个小时但没有成功。

一些环境信息:

PHP Version 7.0.26
Linux version 2.6.32-504.8.1.el6.x86_64 Red Hat 4.4.7-11

我遵循了以下步骤:

安装即时客户端

rpm -Uvh oracle-instantclient12.2-basic-12.2.0.1.0-1.x86_64.rpm
rpm -Uvh oracle-instantclient12.2-tools-12.2.0.1.0-1.x86_64.rpm

export LD_LIBRARY_PATH="/usr/lib/oracle/12.2/client64/lib/"
export ORACLE_HOME="/usr/lib/oracle/12.2/client64/"

安装 OCI8

sudo pecl install oci8

-bash-4.1$ sudo pecl install oci8
downloading oci8-2.1.8.tgz ...
Starting to download oci8-2.1.8.tgz (194,154 bytes)
.........................................done: 194,154 bytes
11 source files, building
running: phpize
Configuring for:
PHP Api Version:         20151012
Zend Module Api No:      20151012
Zend Extension Api No:   320151012
Please provide the path to the ORACLE_HOME directory. Use 'instantclient,/path/to/instant/client/lib' if you're compiling with Oracle Instant Client [autodetect] 

我过去的目录:/usr/lib/oracle/12.2/client64/

building in /var/tmp/pear-build-rootqQ3gpn/oci8-2.1.8
running: /var/tmp/oci8/configure --with-php-config=/usr/bin/php-config --with-oci8=/usr/lib/oracle/12.2/client64/
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for PHP prefix... /usr
checking for PHP includes... -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
checking for PHP extension directory... /usr/lib64/php/modules
checking for PHP installed headers prefix... /usr/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... gawk
checking for Oracle Database OCI8 support... yes, shared
checking PHP version... 7.0.26, ok
checking OCI8 DTrace support... no
checking size of long int... 8
checking checking if we're on a 64-bit platform... yes
checking Oracle ORACLE_HOME install directory... /usr/lib/oracle/12.2/client64/
checking ORACLE_HOME library validity... lib
checking Oracle library version compatibility... 12.1
checking for a sed that does not truncate output... (cached) /bin/sed
checking for fgrep... /bin/grep -F
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1966080
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for ar... ar
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for dlfcn.h... yes
checking for objdir... .libs
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC -DPIC
checking if cc PIC flag -fPIC -DPIC works... yes
checking if cc static flag -static works... no
checking if cc supports -c -o file.o... yes
checking if cc supports -c -o file.o... (cached) yes
checking whether the cc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
configure: creating ./config.status
config.status: creating config.h
config.status: executing libtool commands
running: make
/bin/sh /var/tmp/pear-build-rootqQ3gpn/oci8-2.1.8/libtool --mode=compile cc  -I. -I/var/tmp/oci8 -DPHP_ATOM_INC -I/var/tmp/pear-build-rootqQ3gpn/oci8-2.1.8/include -I/var/tmp/pear-build-rootqQ3gpn/oci8-2.1.8/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  -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-rootqQ3gpn/oci8-2.1.8/include -I/var/tmp/pear-build-rootqQ3gpn/oci8-2.1.8/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 -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:
/var/tmp/oci8/php_oci8_int.h:46:29: error: oci8_dtrace_gen.h: No such file or directory
/var/tmp/oci8/oci8.c:3375: error: expected expression before ‘)’ token
/var/tmp/oci8/oci8.c:3375: error: invalid operands to binary * (have ‘const struct zend_ini_entry_def *’ and ‘const struct zend_ini_entry_def *’)
/var/tmp/oci8/oci8.c:3375: error: ‘zend_oci_globals’ has no member named ‘in_call’
/var/tmp/oci8/oci8.c:3378: error: ‘php_oci_spool’ has no member named ‘spool_hash_key’
/var/tmp/oci8/oci8.c:3379: error: ‘php_oci_spool’ has no member named ‘spool_hash_key’
/var/tmp/oci8/oci8.c:3379: warning: passing argument 1 of ‘free’ discards qualifiers from pointer target type
/usr/include/stdlib.h:488: note: expected ‘void *’ but argument is of type ‘const struct zend_ini_entry_def *’
/var/tmp/oci8/oci8.c: At top level:
/var/tmp/oci8/oci8.c:3392: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘php_oci_ping_init’
/var/tmp/oci8/oci8.c:3434: error: expected declaration specifiers or ‘...’ before ‘sb4’
/var/tmp/oci8/oci8.c:3434: error: expected declaration specifiers or ‘...’ before ‘ub4’
/var/tmp/oci8/oci8.c: In function ‘php_oci_dtrace_check_connection’:
/var/tmp/oci8/oci8.c:3438: error: ‘php_oci_connection’ has no member named ‘client_id’
/var/tmp/oci8/oci8.c:3438: error: ‘php_oci_connection’ has no member named ‘is_open’
/var/tmp/oci8/oci8.c:3438: error: ‘errcode’ undeclared (first use in this function)
/var/tmp/oci8/oci8.c:3438: error: ‘serverStatus’ undeclared (first use in this function)
make: *** [oci8.lo] Error 1
ERROR: `make' failed

是oracle客户端和php版本冲突吗?

yum install systemtap-sdt-devel

export PHP_DTRACE=yes

它的工作很好。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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