4WebHelp
 FAQ  •  Search  •  User Groups  •  Forum Admins  •  Smilies List  •  Statistics  •  Rules   •  Login   •  Register
Toggle Navigation Menu

 PHP: fopen failure question
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic
Author Message
php4ever
Junior WebHelper
Junior WebHelper


Joined: 10 Oct 2002
Posts: 49

PostPosted: Mon Jan 20, 2003 11:16 pm (14 years, 9 months ago) Reply with QuoteBack to Top

Hi, I have a site where according to phpinfo(), fopen_url is enabled at both the local and master levels. However, fopen isn't working anywhere on my site today and I haven't touched the code. Here's a test page that I created:

<?php

$h = fopen("http://www.php.net","r");
if ($h)
{ print "The file exists!"; }
else
{ print "The file does not exist"; }



?>

and when I ran it the results were like this:

Warning: php_network_getaddresses: getaddrinfo failed: Name or service not known in /web/sites/112/slevy/www.preservestaffnow.org/fopen_test.php on line 3

Warning: fopen("http://www.php.net", "r") - Bad file descriptor in /web/sites/112/slevy/www.preservestaffnow.org/fopen_test.php on line 3
The file does not exist

So, does anybody have any ideas as to why I would get these error messages if fopen_url is enabled? Or, can the phpinfo() be providing results that no longer reflect the current configuration?

Any thoughts you might have to share I'd greatly appreciate.

-- php4ever

p.s. fsockopen is also not working at my site.
OfflineView User's ProfileFind all posts by php4everSend Personal Message
adam
Forum Moderator & Developer



Joined: 26 Jul 2002
Posts: 704
Location: UK

PostPosted: Fri Jan 24, 2003 6:27 pm (14 years, 9 months ago) Reply with QuoteBack to Top

I don't think that php follows http redirects...so you may have to type the full url, i.e. $h = fopen('http://www.php.net/index.php');

not sure though.

________________________________
It's turtles all the way down...
OfflineView User's ProfileFind all posts by adamSend Personal MessageVisit Poster's Website
Daniel
Team Member



Joined: 06 Jan 2002
Posts: 2564

PostPosted: Fri Jan 24, 2003 6:36 pm (14 years, 9 months ago) Reply with QuoteBack to Top

Adam, how is this a redirect? If you go to http://www.php.net, you're not going to be redirected to http://www.php.net/index.php. However, you may need to add a trailing slash...

________________________________
Image
OfflineView User's ProfileFind all posts by DanielSend Personal Message
adam
Forum Moderator & Developer



Joined: 26 Jul 2002
Posts: 704
Location: UK

PostPosted: Fri Jan 24, 2003 6:40 pm (14 years, 9 months ago) Reply with QuoteBack to Top

that's what I was getting at, I added index.php for good measure.

________________________________
It's turtles all the way down...
OfflineView User's ProfileFind all posts by adamSend Personal MessageVisit Poster's Website
php4ever
Junior WebHelper
Junior WebHelper


Joined: 10 Oct 2002
Posts: 49

PostPosted: Fri Jan 31, 2003 9:36 am (14 years, 8 months ago) Reply with QuoteBack to Top

As it turns out, I was getting the bizarre error messages b/c apparently
the web server and/or database server where my site is hosted was
having problems.

Thankfully the problems are now gone. Very Happy And, when I run the above script,
it runs fine despite my neglecting to add that trailing slash. However,
maybe it should be included. I noticed that almost everyone contributing
notes on php.net's documentation of fopen includes it when referring to urls with terminations like .net, .com, etc.

-- php4ever
OfflineView User's ProfileFind all posts by php4everSend Personal Message
Display posts from previous:      
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic


 Jump to:   




You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot edit your posts in this forum.
You cannot delete your posts in this forum.
You cannot vote in polls in this forum.


Page generation time: 0.060214 seconds :: 17 queries executed :: All Times are GMT
Powered by phpBB 2.0 © 2001, 2002 phpBB Group :: Based on an FI Theme