Page 1 of 1

PHP fopen() error...

Posted: Thu Oct 04, 2012 12:58 pm
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?

Re: PHP fopen() error...

Posted: Thu Oct 04, 2012 1:18 pm
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?