fopen在我的服务器上不起作用 [英] fopen is not working on my server
问题描述
它在使用Xampp的localhost上可以完美运行,但是当我在服务器(host-ed.net)上尝试使用它时,fopen无法打开任何url,它仅适用于没有http的文件.
It works perfectly on localhost with Xampp, but when I try it on my server (host-ed.net), fopen can't open any url, it only works for files without http.
<?php
$file="http://www.google.es";
$gestor = fopen($file, "r") or die ("Nothing");
?>
在我的服务器上,此代码显示为Nothing.可以是php.ini上的任何内容吗?
In my server with this code shows Nothing. Can be anything on the php.ini ?
在php.ini中:allow_url_fopen =开
In the php.ini: allow_url_fopen = On
已解决.我的服务器已将其禁用,但现在已启用.感谢您的回答.
It's solved. My server had it disabled, but now it's enabled. Thanks for the answers.
推荐答案
fopen无法打开任何URL
fopen can't open any url
检查 allow_url_fopen
的值php.ini设置:
Check the value of the allow_url_fopen
php.ini setting:
var_dump(ini_get('allow_url_fopen'));
这可能是错误的.您需要与网络托管服务商交谈,或尝试其他方法. Mabye CURL 是否已启用?
It's probably false. You'll need to speak to your web host, or try another method. Mabye CURL is enabled?
您还应该检查 error_reporting
和
You should also check your error_reporting
and display_errors
values. PHP should have complained loudly about being unable to open the URL. You'll want to turn both of them all the way up while developing code, so you can understand what goes wrong easier.
这篇关于fopen在我的服务器上不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!