解决PHP Warning: file_get_contents failed to open stream: no suitable wrapper could be found.
post by rocdk890 / 2013-5-14 13:39 Tuesday linux技术
今天给blog添加gravatar头像缓存功能,php报下面的错误:
PHP Warning: file_get_contents failed to open stream: no suitable wrapper could be found.
网上搜了下,找到了解决办法,现放出来给大家看看.
系统:centos 5.5
在错误日志中,php报的错误是
1 | PHP Warning: file_get_contents(url=domainname]Portal Home - DomainName, Inc.) [<a href= 'function.file-get-contents' > function . file -get-contents</a>]: |
2 | failed to open stream: no suitable wrapper could be found in /home/cpanelusername/public_html/ test .php on line. |
此警告说服务器阻止访问远程文件,修改php.ini
把
allow_url_fopen = Off
allow_url_include = Off
改成
allow_url_fopen = On
allow_url_include = On
重启php-fpm或者重启web服务.