linux php c 扩展,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. 运行测试脚本

print confirm_myfunctions_compiled("myextension");

?>0b1331709591d260c1c78e86d0c51c18.png

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值