1. 下载php并解包
tar zxvf php-5.2.8.tar.gz
gzip -cd php-5.2.8-fpm-0.5.10.diff.gz | patch -d php-5.2.8 -p1
cd php-5.2.8/
2. 使用php工具生成基本的扩展模块的架构
./ext_skel --extname myext
cd myext
3. 修改config.m4
修改
PHP_ARG_WITH(myext, for myext support,
dnl Make sure that the comment is aligned:
[ --with-myext Include myext support])
或者
PHP_ARG_ENABLE(myext, whether to enable myext support,
dnl Make sure that the comment is aligned:
[ --enable-myext Enable myext support])
4. 在当前目录使用phpize生成配置文件
5. 生成扩展库
./configure --with-myext --with-php-config=PATH
make
make install
6. 修改php.ini,增加扩展myext.so
7.重启php-cgi
8. 运行测试脚本
<?php
print confirm_myfunctions_compiled("myextension");
?>