Jpgraph upgrade causing script issue - issue resolved

RESOLVED
I am trying to get my site off of php 5.6 and move to 7.2. My JPGraph program needed to be upgraded which I have done and now at 4.2.6. With this new release it messed up a bunch of my php scripts I use with some one wire temp sensors I have. The script below pulls 24 hours worth of temps and plots on a graph and puts the current temp in the middle of the graph. I get a 500 error if I run the script as is below. However if I remove the lines of code in the second code example below, the script will run and plot the 24 hour temps in one hour increments but not display the current temp in the middle (which I removed).

Can someone look at the 2nd code example below and tell me if you see anything that is depreciated etc. that would cause the error. Again when I remove the code in the second example from the overall script it runs fine just doesn’t show the current temp in the middle of the graph like it used to.

Thanks a lot,
John

<?php
//where are your clientraw*-files relative to where this file is
$hostloc = "./";
date_default_timezone_set('America/Halifax');
include ("jp/src/jpgraph.php");           //maybe you have to change this path
include ("jp/src/jpgraph_line.php");       //maybe you have to change this path

// CtoF: converts degrees Celcius to degress Farenheight
function CtoF(&$value) {
  return round($value = ((1.8* $value) + 32),1);
} // end function C_to_F

// Create the graph and specify the scale for Y-axis
$graph = new Graph(400,250,"auto",30);    
$graph->SetScale("textlin");
$graph->SetShadow();
$graph->SetMarginColor("#191970");
$graph->img->SetAntiAliasing();

$url = "http://www.auburnweatherlive.com/basementdatapull.php";   // this is the page where you get the information
$str = file_get_contents($url);                                // retrieve the content of the page. This results in one single string with all the content

$str = ereg_replace(" 
","","$str");
$str = ereg_replace("X_Axis = ","","$str");                   
$str = ereg_replace("Y_Axis = ","xx","$str");

$data = explode("xx", $str);                                   // xx is the separator. You will get two strings in $data
$x = $data[0];                                                 // first part of $data is the X_Axis data
$y = $data[1];                                                 // second part of $data is the Y_Axis data

$datat = explode(" ", $x);                                     // make an array of $x 
$ydata = explode(" ", $y);                                     // make an array of $y

//create timearray for the x-axis
$n=1;
$limit=26;
putenv('TZ=Canada/Atlantic');
$time=date(" H",time());
$datat=array($time);
$x=$datat;
//what you have to add
$add=3600;
$result=strtotime(now);
for ($n=1;$n++;)
{
$result=($result-$add);
$new=date('ga', $result);
$next=array("$new");
$datat= array_merge ($next,$datat);
if ($n>=$limit) break;
  }
$datat=array_merge($datat,$x);

// =====================================================================================
// From here we start creating the graphs
// =====================================================================================

// Adjust the margin
$graph->img->SetMargin(40,40,20,65);

// Create the two linear plot
$lineplot=new LinePlot($ydata);

// Add the plot to the graph
$graph->Add($lineplot);

//titles
$graph->title->Set("Basement");
$graph->title->SetFont(FF_FONT1,FS_BOLD,10);
$graph->title->SetColor("white");
//$graph->xaxis->title->Set("X-title");
//$graph->yaxis->title->Set("Y-title");

//x-axis
//$graph->xaxis->title->Set("X-title");
$time=date("M j",time());
$graph->xaxis->title->Set($time);
$graph->xaxis->title->SetColor(white);
$graph->xaxis->SetFont(FF_FONT1,FS_NORMAL,4);
$graph->xaxis->SetTickLabels($datat); 
$graph->xaxis->SetTextLabelInterval(3);
$graph->xaxis->SetPos("min"); 
$graph->xaxis->SetColor("white"); 
$graph->xaxis->HideTicks(true,true); 
$graph->xgrid->Show(true);

//y-axis
$graph->yaxis->SetColor("white");
$graph->yaxis->SetLabelFormat('%0.0f

I would expect to see the error in the web server log file, can you access that to see what actual error is displayed?

Stuart

All is can see is an error in Cpanel raw data error stating the file name and that it caused a 500 error. That