使用php-cpp为php创建扩展

时间:2015-12-18 07:20:53

标签: centos server g++ php-cpp

我想为php创建一个扩展 我想安装php-cpp

http://www.php-cpp.com/documentation/install

显示错误:

................
zend/constantimpl.h:185:38: error: ‘zend_constant’ has no member named ‘name_len’
zend/constantimpl.h:185:38: error: ‘zend_constant’ has no member named ‘name_len’
zend/constantimpl.h:188:68: error: cannot convert ‘zend_string* {aka _zend_string*}’ to ‘char*’ for argument ‘1’ to ‘char* strncpy(char*, const char*, size_t)’
zend/constantimpl.h:189:62: error: cannot convert ‘zend_string* {aka _zend_string*}’ to ‘char*’ for argument ‘1’ to ‘char* strncpy(char*, const char*, size_t)’
zend/constantimpl.h:190:77: error: cannot convert ‘zend_string* {aka _zend_string*}’ to ‘char*’ for argument ‘1’ to ‘char* strncpy(char*, const char*, size_t)’
zend/constantimpl.h:195:23: error: ‘zend_constant’ has no member named ‘name_len’
zend/constantimpl.h:196:60: error: ‘zend_constant’ has no member named ‘name_len’
make: *** [shared/zend/base.o] Error 1
......

安装时需要将我们的g ++编译器升级到上面的版本4.8.x.

如何在centos系统中“将我们的g ++编译器升级到版本4.8.x以上”

1 个答案:

答案 0 :(得分:0)

我也遇到过这个问题。据我所知,有两种选择:

  1. 升级到CentOS 7 - 它有g ++ 4.8.5

  2. 在CentOS 6.7上,安装devtoolset-2,其中包含g ++ 4.8.2

  3. 我不知道究竟在哪里获得devtoolset-2(我的系统管理员为我安装了它),但我相信你可以在网上找到它。请注意,您需要执行类似的操作 export CXX='/opt/rh/devtoolset-2/root/usr/bin/g++'以确保您使用的是较新的编译器。

    this SO question的答案可能对选项2有帮助。