下载后,make 时需要读取php的相关.h文件。
要先添加以下地址(假如php安装目录位于/usr/local/php)
export CPLUS_INCLUDE_PATH=/usr/local/php/include/php/main:/usr/local/php/include/php/Zend:$CPLUS_INCLUDE_PATH
export CPLUS_INCLUDE_PATH=/usr/local/php/include/php/TSRM:$CPLUS_INCLUDE_PATH
export CPLUS_INCLUDE_PATH=/usr/local/php/include/php:$CPLUS_INCLUDE_PATH
export CPLUS_INCLUDE_PATH=/usr/local/php/include/php:$CPLUS_INCLUDE_PATH
cp /usr/local/php/bin/php-config /usr/bin/php-config
再make即可
编译完成结果如图:
make install
- 测试生成PHP拓展
从官网下载空拓展包
修改makefile 32 行
INI_DIR = /usr/local/php/conf.d //改为自己的php的
然后到拓展包目录下再make,make install,最后php -m检查是否正确