PHP fopen() error...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
dimxasnewfrozen
Forum Commoner
Posts: 84
Joined: Fri Oct 30, 2009 1:21 pm

PHP fopen() error...

Post by dimxasnewfrozen »

So, I'm stumped.

I have 2 servers with the exact same code. One works and the other does not. What is not working in particular is:

$file = fopen("../index.php?a=1", 'r');
$file = fopen($url, 'r' );

I get an error on saying:

Warning: fopen() [function.fopen]: php_network_getaddresses: getaddrinfo failed: Name or service not known in /var/www/html/test.php line 4

I did some searching around and saw that it could be a dns issue - since one version of the code works and one doesn't this could be the case. Any ideas?
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: PHP fopen() error...

Post by requinix »

The first one should never work.

Whether the second one does depends on what $url is and potentially whether you have the allow_url_fopen setting enabled (though when turned off you'd probably get a different error message). What are their values?
Post Reply