Okay guys so I have this error coming up in my server errors and its being caused by Google Graph I have displayed on one of the pages of my site. After some time with the graph loaded on the page this loops out of control and the server runs out of memory and i get major I/O errors on my cPanel.
[22-Oct-2014 19:14:23 UTC] PHP Warning: fgets() expects parameter 1 to be resource, boolean given in /home/gift3dsaint/public_html/graph.php on line 44
[22-Oct-2014 19:14:23 UTC] PHP Warning: feof() expects parameter 1 to be resource, boolean given in /home/gift3dsaint/public_html/graph.php on line 42
[22-Oct-2014 19:14:23 UTC] PHP Warning: fgets() expects parameter 1 to be resource, boolean given in /home/gift3dsaint/public_html/graph.php on line 44
[22-Oct-2014 19:14:23 UTC] PHP Warning: feof() expects parameter 1 to be resource, boolean given in /home/gift3dsaint/public_html/graph.php on line 42
[22-Oct-2014 19:14:23 UTC] PHP Warning: fgets() expects parameter 1 to be resource, boolean given in /home/gift3dsaint/public_html/graph.php on line 44
[22-Oct-2014 19:14:23 UTC] PHP Warning: feof() expects parameter 1 to be resource, boolean given in /home/gift3dsaint/public_html/graph.php on line 42
The code I have referencing to the graph is this PHP:
$lines=array();
$fp = fopen($file, "r");
while(!feof($fp)) {
$line = fgets($fp, 4096);
array_push($lines, $line);
}
fclose($fp);