在做项目时用 file_get_contents 来获取数据,php 报错 PHP Warning: file_get_contents failed to open stream: no suitable wrapper could be found.
最后用了curl来获取数据!
今天百度了一下!找到了解决办法!先拷贝过来!
系统:centos 6.5
在错误日志中,php报的错误是
Warning: file_get_contents() [function.file-get-contents]: http:// wrapper is disabled in the server configuration by allow_url_fopen=0
failed to open stream: no suitable wrapper could be found
此警告说服务器阻止访问远程文件,修改php.ini
把
allow_url_fopen = Off
allow_url_include = Off
改成
allow_url_fopen = On
allow_url_include = On
重启php-fpm或者重启web服务。
转载时请注明出处及相应链接,本文永久地址:https://blog.yayuanzi.com/12415.html
微信打赏
支付宝打赏
感谢您对作者Bruin的打赏,我们会更加努力! 如果您想成为作者,请点我