[php 拓展开发] hello world

1、下载php源码包

2、在php-7.0.9/ext 下执行 ./ext_skel --extname=hello 

3、

 4、拓展代码

 5、

6、编译

多了分号,出错。

重新编译成功,但是生成的文件(.so)没有移动到php拓展目录下。还需手动移动。

上图可以看到 modules 目录下生成的hello.so文件。

使用 php -info | more 查看php配置信息,可看到拓展路径。

配置php.ini,加上extensions = hello.so

最后,使用hello()

来源:http://www.bo56.com/php7%E6%89%A9%E5%B1%95%E5%BC%80%E5%8F%91%E4%B9%8Bhello-word/

php的启动与终止

原文地址:https://www.cnblogs.com/natian-ws/p/7699963.html