Jump to content

Fopen error for remote URL


robingram

Recommended Posts

Hi,

I've just compiled a new version of PHP and it all seems to work except where I'm trying to include a file from a remote server.  I get the error "failed to open stream: HTTP request failed!" in the apache error log after the default_socket_timeout (60 seconds).  It [i]doesn't[/i] give an error code (e.g 404)

allow_url_fopen is set to On in php.ini.  The problem only occurs connecting to remote servers.  I can include files on the same server using http and filesystem paths.

I started with PHP 5.2 (with allow_url_include also set to On) but then tried PHP 5.1.6 but I get the same error.

I'm running on Solaris 10 with Apache 1.3.36.

This simple test script fails:

<?php
if (fopen("http://www.google.com","r")) echo "OK";
?>

Any help would be greatly appreciated.

[Edit] BTW, I can access the URLs I'm attempting to include through a web browser so it isn't a network problem.

Thanks,

Rob.






Link to comment
https://forums.phpfreaks.com/topic/30357-fopen-error-for-remote-url/
Share on other sites

Seems dumb, but it's happened to me before... might want to check that the php.ini you're looking at is the one that php is actually reading...

[code]
%> php -i | grep ini | grep Path
[/code]

I only suggest this because it sounds like an allow_url_fopen issue and you just compiled a new version of php.

You can also check

[code]
ini_get('allow_url_fopen');
[/code]
Thanks for the reply.

The php.ini file seems to be correct and I can see any changes made when I do phpinfo().

I had also tried ini_set("allow_url_fopen", "On"); in the script and it didn't help.  In any case, ini_get('allow_url_fopen'); returns 1.

As far as I can tell everything is set as it should be.  I've even set the User Agent to a sensible value but nothing seems to help.  :(

Rob.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.