PHP-CPP 安装

默北 PHPPHP-CPP 安装已关闭评论12,348字数 1230阅读4分6秒阅读模式

PHP-CPP是一个用于开发PHP扩展的C++库。它提供了一套详实易用的类,用于开发PHP扩展。详细文档说明:http://www.php-cpp.com

如果在安装过程中报下面的错误:文章源自运维生存时间-https://www.ttlsa.com/php/how-to-install-php-cpp/

g++ -Wall -c -g -std=c++11 -fpic -o shared/common/modifiers.o common/modifiers.cpp
cc1plus: error: unrecognized command line option “-std=c++11″
make: *** [shared/common/modifiers.o] Error 1文章源自运维生存时间-https://www.ttlsa.com/php/how-to-install-php-cpp/

解决方法参见《c++11 gcc4.8.x安装》文章源自运维生存时间-https://www.ttlsa.com/php/how-to-install-php-cpp/

在安装PHP-CPP过程中会报如下错误:文章源自运维生存时间-https://www.ttlsa.com/php/how-to-install-php-cpp/

g++ -Wall -c -g -std=c++11 -fpic -o common/modifiers.o common/modifiers.cpp
g++ -Wall -c -g -std=c++11 -fpic -o common/streambuf.o common/streambuf.cpp
g++ -Wall -c -g -std=c++11 -fpic `php-config --includes` -o zend/base.o zend/base.cpp
In file included from zend/includes.h:112:0,
from zend/base.cpp:8:
zend/objectimpl.h: In constructor  hp::ObjectImpl::ObjectImpl(zend_class_entry*, Php::Base*)
zend/objectimpl.h:88:95: error: val_property_ctor鈥was not declared in this scope
zend_hash_copy(_mixed->php.properties, &entry->default_properties, (copy_ctor_func_t) zval_property_ctor, &tmp, sizeof(zval*));
^
make: *** [zend/base.o] Error 1文章源自运维生存时间-https://www.ttlsa.com/php/how-to-install-php-cpp/

解决办法如下:文章源自运维生存时间-https://www.ttlsa.com/php/how-to-install-php-cpp/

1. 下载对应的php源码文章源自运维生存时间-https://www.ttlsa.com/php/how-to-install-php-cpp/

2. 解压php源码,将源码目录下的zend目录拷贝到php-cpp源码目录下,用以替换php-cpp自带的zend文章源自运维生存时间-https://www.ttlsa.com/php/how-to-install-php-cpp/

3. 重新编译安装php-cpp文章源自运维生存时间-https://www.ttlsa.com/php/how-to-install-php-cpp/

安装过程如下:文章源自运维生存时间-https://www.ttlsa.com/php/how-to-install-php-cpp/

# git clone https://github.com/andot/PHP-CPP.git
# cd PHP-CPP/
# mv zend zend_org
# cp -Rf /path/to/php_source/zend ./
# make
# make install
# cp libphpcpp.so /usr/local/php/lib/php/extensions/no-debug-non-zts-20121212/
# vim /usr/local/php/etc/php.ini
extension = libphpcpp.so
文章源自运维生存时间-https://www.ttlsa.com/php/how-to-install-php-cpp/文章源自运维生存时间-https://www.ttlsa.com/php/how-to-install-php-cpp/
weinxin
我的微信
微信公众号
扫一扫关注运维生存时间公众号,获取最新技术文章~
默北
  • 本文由 发表于 13/12/2014 01:00:21
  • 转载请务必保留本文链接:https://www.ttlsa.com/php/how-to-install-php-cpp/
  • PHP-CPP