在PHP7

时间:2016-05-12 15:18:45

标签: php linux pdo driver oci8

他,

我尝试了几天在新服务器上安装PHP7上的PDO_OCI。 我曾经在其他服务器PDO_OCI上,但在PHP 5.4上,一切都很好,这个版本没有问题。

我收到了消息:

:/home/pear/download/PDO_OCI-1.0# make
/bin/bash /home/pear/download/PDO_OCI-1.0/libtool --mode=compile cc -I -I. 
-I/home/pear/download/PDO_OCI-1.0 -DPHP_ATOM_INC 
-I/home/pear/download/PDO_OCI-1.0/include 
-I/home/pear/download/PDO_OCI-1.0/main 
-I/home/pear/download/PDO_OCI-1.0 
-I/usr/include/php/20151012 
-I/usr/include/php/20151012/main 
-I/usr/include/php/20151012/TSRM 
-I/usr/include/php/20151012/Zend 
-I/usr/include/php/20151012/ext 
-I/usr/include/php/20151012/ext/date/lib 
-I/usr/lib/oracle/instantclient/include/oracle/12.1/client  -DHAVE_CONFIG_H  -g -O2   -c 
/home/pear/download/PDO_OCI-1.0/oci_driver.c -o oci_driver.lo
libtool: compile:  cc -I -I. 
-I/home/pear/download/PDO_OCI-1.0 -DPHP_ATOM_INC 
-I/home/pear/download/PDO_OCI-1.0/include 
-I/home/pear/download/PDO_OCI-1.0/main 
-I/home/pear/download/PDO_OCI-1.0 
-I/usr/include/php/20151012 
-I/usr/include/php/20151012/main 
-I/usr/include/php/20151012/TSRM 
-I/usr/include/php/20151012/Zend 
-I/usr/include/php/20151012/ext 
-I/usr/include/php/20151012/ext/date/lib 
-I/usr/lib/oracle/instantclient/include/oracle/12.1/client -DHAVE_CONFIG_H -g -O2 -c 
/home/pear/download/PDO_OCI-1.0/oci_driver.c  -fPIC -DPIC -o .libs/oci_driver.o

/home/pear/download/PDO_OCI-1.0/oci_driver.c: In function 'pdo_oci_fetch_error_func':
/home/pear/download/PDO_OCI-1.0/oci_driver.c:51:3: error: 
too many arguments to function 'add_next_index_string' add_next_index_string(info, einfo->errmsg, 1);

In file included from /usr/include/php/20151012/main/php.h:39:0,
                 from /home/pear/download/PDO_OCI-1.0/oci_driver.c:25:
/usr/include/php/20151012/Zend/zend_API.h:432:14: note: declared here
 ZEND_API int add_next_index_string(zval *arg, const char *str);
              ^
/home/pear/download/PDO_OCI-1.0/oci_driver.c: In function 'oci_handle_preparer':
/home/pear/download/PDO_OCI-1.0/oci_driver.c:238:59: warning: passing argument 5 of 'pdo_parse_params' from incompatible pointer type
  ret = pdo_parse_params(stmt, (char*)sql, sql_len, &nsql, &nsql_len TSRMLS_CC);
                                                       ^
In file included from /home/pear/download/PDO_OCI-1.0/oci_driver.c:29:0:
/usr/include/php/20151012/ext/pdo/php_pdo_driver.h:678:13: note: expected 'size_t *' but argument is of type 'int *'
 PDO_API int pdo_parse_params(pdo_stmt_t *stmt, char *inquery, size_t inquery_len,
         ^
/home/pear/download/PDO_OCI-1.0/oci_driver.c: At top level:
/home/pear/download/PDO_OCI-1.0/oci_driver.c:411:2: warning: initialization from incompatible pointer type
  oci_handle_preparer,
 ^
/home/pear/download/PDO_OCI-1.0/oci_driver.c:411:2: warning: (near initialization for 'oci_methods.preparer')
/home/pear/download/PDO_OCI-1.0/oci_driver.c:412:2: warning: initialization from incompatible pointer type
  oci_handle_doer,
  ^
/home/pear/download/PDO_OCI-1.0/oci_driver.c:412:2: warning: (near initialization for 'oci_methods.doer')
/home/pear/download/PDO_OCI-1.0/oci_driver.c:413:2: warning: initialization from incompatible pointer type
  oci_handle_quoter,
  ^
/home/pear/download/PDO_OCI-1.0/oci_driver.c:413:2: warning: (near initialization for 'oci_methods.quoter')
Makefile:198: recipe for target 'oci_driver.lo' failed
make: *** [oci_driver.lo] Error 1

我的配置: Linux服务器系统Linux 3.16.0-4-amd64#1 SMP Debian 3.16.7-ckt20-1 + deb8u4(2016-02-29)x86_64 PHP PHP版本7.0.4-1~docdeb + 8.1 PDO驱动程序mysql 启用OCI8支持(正在工作)。

我读过PDO_OCI包含在PHP7上https://github.com/php/php-src/tree/PHP-7.0.7/ext/pdo_oci 但是如何激活呢?

我的PHP 5.4代码不能在PHP7服务器上运行。

有人有解决方案吗?

此致

2 个答案:

答案 0 :(得分:2)

下载此php源代码 http://us1.php.net/get/php-7.0.27.tar.bz2/from/a/mirror

将pdo_oci复制到tmp

$ sudo cp -r php-7.0.27/ext/pdo_oci /tmp

$ sudo cd /tmp/pdo_oci

运行下一个命令:

在这里输入代码

$ sudo phpize

$ sudo make

$ sudo make install

Finall,创建和链接文件 $ sudo touch /etc/php/7.0/mods-available/pdo_oci.ini

$sudo echo extension=pdo_oci.so' > /etc/php/7.0/mods-available/pdo_oci.ini

$ sudo ln -s /etc/php/7.0/mods-available/pdo_oci.ini /etc/php/7.0/apache2/conf.d/20-pdo_oci.ini

重启apache2

答案 1 :(得分:0)

This extension已被放弃,无法编译。为什么? PHP的版本在第7版中发生了重大变化。您看到的错误表明内部函数签名已更改:

/home/pear/download/PDO_OCI-1.0/oci_driver.c: In function 'pdo_oci_fetch_error_func':
/home/pear/download/PDO_OCI-1.0/oci_driver.c:51:3: error: 
too many arguments to function 'add_next_index_string' add_next_index_string(info, einfo->errmsg, 1);

如何解决这个问题取决于你如何安装PHP。我希望你自己编译,因为你对扩展做了同样的事情。如果是这样,只需recompile using --with-pdo-oci=DIR其中DIR是Oracle主目录。

如果您是通过apt从软件包安装的,那么您可以做出一些选择。 1)看看你是否能以同样的方式获得PDO-OCI驱动程序(看起来没有。)2)删除你的包并从源头做所有事情。 3)尝试third-party driver