I have this PHP file which Im using to test RRD support:
<?php
$result=rrd_fetch( "/ang.rrd", array( "AVERAGE", "--resolution", "60", "--start", "-1d", "--end", "start+1h" ) );
foreach ( $result["data"]["myfield"] as $key => $value )
{
echo "At timestamp $key, the value for myfield is $value.
";
}
?>
If I browse to the file I get the following:
PHP Fatal error: Uncaught Error: Call to undefined function rrd_fetch() in /var/www/html/graph.php:2
Stack trace:
#0 {main}
thrown in /var/www/html/graph.php on line 2
and if I try to run the file on the command line I get the following:
PHP Notice: Undefined index: myfield in /var/www/html/graph.php on line 4
PHP Warning: Invalid argument supplied for foreach() in /var/www/html/graph.php on line 4
Im not sure why. Could somebody shed some light on why this is happening please?