php扩展编译nts的方法

来源:互联网 发布:sql查询用户名和密码 编辑:程序博客网 时间:2024/06/08 05:06

最近编译一个扩展遇到很多问题,始终不成功。经过努力查找解决方法,终于解决了。

编译完扩展测试执行测试文件出现下面提示

[root@localhost sample]# /home/php7/bin/php sample.php Warning: dl(): sample: Unable to initialize moduleModule compiled with build ID=API20151012,TSPHP    compiled with build ID=API20151012,NTSThese options need to match in /home/xiongweixing/php-7.0.21/ext/sample/sample.php on line 5Functions available in the test extension:Warning: Invalid argument supplied for foreach() in /home/xiongweixing/php-7.0.21/ext/sample/sample.php on line 10

查看提示觉得可能是ts、nts的问题。

php默认是ts模式,使用nts需要加上下面参数

configure –enable-cli –disable-zts

重新编译扩展再测试运行成功了

[root@localhost sample]# /home/php7/bin/php sample.php Functions available in the test extension:confirm_sample_compiledsample_hello_worldCongratulations! You have successfully modified ext/sample/config.m4. Module sample is now compiled into PHP.
原创粉丝点击