Linux下使用c编写php扩展步骤
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");
?>
相关推荐
Noneyes 2020-11-10
zyyjay 2020-11-09
xuebingnan 2020-11-05
samtrue 2020-11-22
stefan0 2020-11-22
yifangs 2020-10-13
songshijiazuaa 2020-09-24
hebiwtc 2020-09-18
天步 2020-09-17
83911535 2020-11-13
whatsyourname 2020-11-13
zhouyuqi 2020-11-10
mathchao 2020-10-28
王志龙 2020-10-28
wwwsurfphpseocom 2020-10-28
diskingchuan 2020-10-23
savorTheFlavor 2020-10-23