Forum Moderators: coopster

Message Too Old, No Replies

Getaddrinfo Failed Error

getaddrinfo failed php error

         

webzila

8:59 pm on Jun 19, 2005 (gmt 0)

10+ Year Member



On my site I have a script that displays random quotes and messages.

It used to work fine for over 3 years but for the past two weeks I keep getting the following errors which show up randomly and if you refresh the site the script might work fine again.


Warning: main(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /home/httpd/vhosts/domain/httpdocs/index.php on line 76

Warning: main(http://www.domain.com/articles/quotes/quotes.php): failed to open stream: Resource temporarily unavailable in /home/httpd/vhosts/domain/httpdocs/index.php on line 76

At first, the script was setup to open up a small text file and display the text which it contained. The person who hosts the site for me suggested that instead of opening the file I should try a php array. So I did that and I still get the error that I posted above. The error seems to be intermittant.

I have also been told that the /tmp/ directory has been cleared. But that didnt resolve the problem.

Does anyone know what this error means and how to fix it?

jatar_k

4:31 pm on Jun 20, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



what line of code is on line 76 that is generating the error?

webzila

11:03 pm on Jun 20, 2005 (gmt 0)

10+ Year Member



The code on line 76 is:

<?php include "articles/quotes/quotes.php";?>

quotes.php has an array of quotes. Prior to that I was using a text file and had the following code to display the quotes:


<?php
$font ="Verdana";
$fontsize ="2";
$textfile ="http://domain.com/articles/quotes/quotes.txt";
echo "<font face=\"$font\" size=\"$fontsize\">";
$quotes = file("$textfile");
$quote = rand(0, sizeof($quotes)-1);
echo $quotes[$quote];
echo "</font>";
?>

Same error occured with both methods. As stated earlier it doesnt always happen and when it does occur refresh usually fixes it.

Thanks

jatar_k

11:08 pm on Jun 20, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I am really confused for some reason those particular errors make me think something funny is going on.

oh well, first thought

is that path correct?

and which method are we trying to debug here? the array or the textfile?

webzila

11:23 pm on Jun 20, 2005 (gmt 0)

10+ Year Member



Yeah, the path is correct. Right now I am using the array but I was getting an identical error with the script for the text file. Just right now I get that error again but this time it was for the script that displays RSS feed on my page.

The include path is:
include_path='.:/usr/share/pear'

My friend who is hosting my site on the server has also experienced this error a few times on his site. I am pretty sure its some kind of a server error but everytime the host replies and says they cant find anything wrong.

Would rebooting the server help?