解决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服务.
在CentOS 5.5系统上,遇到PHP Warning提示无法找到合适的包装器访问远程文件。错误源于allow_url_fopen设置为Off。解决方法是将php.ini中的allow_url_fopen和allow_url_include改为On,然后重启PHP服务。
2057

被折叠的 条评论
为什么被折叠?



