欢迎来到程序员中文网!

首页 Linux Mysql C++ Python PHP JavaScript 资源下载 动态 开源推荐
我要投稿 投诉建议

如何安装 PHP-CPP

时间:2026年01月15日 07:01:56 浏览:0

php原生扩展开发,采用C语言开发,混合大量Zend函数,开发扩展需要额外学习Zend,所以推荐大家使用PHP-CPP开发PHP扩展。



PHPCPP安装


下载地址:https://github.com/CopernicaMarketingSoftware/PHP-CPP

编译并安装


下载后上传服务器进入目录然后编译并安装PHPCPP


make &&sudo make install

如果报错


mkdir -p shared/common
mkdir -p shared/zend
g++ -Wall -c -std=c++11 -fvisibility=hidden -DBUILDING_PHPCPP -Wno-write-strings -MD -g `php-config --includes` -fpic -o shared/common/modifiers.o common/modifiers.cpp
/bin/sh: php-config: command not found
common/modifiers.cpp:13:10: fatal error: php.h: No such file or directory
#include <php.h>
^~~~~~~
compilation terminated.
make: *** [Makefile:213: shared/common/modifiers.o] Error 1

解决方法


[root@192 PHP-CPP-php7]# rm -rf /usr/bin/php-config
[root@192 PHP-CPP-php7]# ln -s /www/server/php/74/bin/php-config /usr/bin