🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
[TOC] ## 环境要求 ### gcc >7.2.0 GCC版本不能太低,因为需要支持c++11特性。 `gcc -v` 如果你是centos,可能GCC版本最高就是4.4.7,这时候只能通过手动编译重新安装了 ## 安装 ### MacOs ,Linux ``` $ git clone https://github.com/CopernicaMarketingSoftware/PHP-CPP.git $ cmake . $ make $ sudo make insatll ``` ### window 在 cmake 前需要修改 `CMakeLists.txt` ``` # Use CMake File with following options #PHPCPP_COMPILE_TS #Set flag if PHP was compiled with thread safe # PHPCPP_MSVCRT_STATIC Set flag if you want to compile the MSVC runtime as a static library #PHPCPP_ARCH #Set to "x86_64" if architecture and PHP was compiled under x64 or "x86" for 32 bit # PHPCPP_PHP_PATH The path to PHP sources SET(PHPCPP_MSVCRT_STATIC true) SET(PHPCPP_ARCH true) SET(PHPCPP_PHP_PATH "/php/php-7.2.13-src") ``` ### 测试 在PHP-CPP 下有Examples,流程如下 ``` > make > sudo make install ``` 如果 make install 失败, 注意修改 Makefile 文件的扩展位置和配置位置 ``` LIBRARY_DIR = $(shell php-config --extension-dir) PHP_CONFIG_DIR = ${shell php --ini | grep Scan | cut -d" " -f7} ```