0
我試圖使用Phpgraphlib在我的網頁上顯示圖形。 我使用下面的代碼:Phpgraphlib:內部服務器錯誤
PHP腳本(graph.php):
<?php
include("phpgraphlib.php");
error_reporting(E_ALL^E_DEPRECATED^E_NOTICE);
$graph=new PHPGraphLib(550,350);
$link = mysql_connect('127.0.0.1', 'xxxx', 'xxxx') or die('Could not connect: ' . mysql_error());
mysql_select_db('quality') or die('Could not select database');
$dataArray=array();
//get data from database
$sql="SELECT country, tot_reg FROM ntr_perf_no_net WHERE data = '2016-09-05'";
$result = mysql_query($sql) or die('Query failed: ' . mysql_error());
if ($result) {
while ($row = mysql_fetch_assoc($result)) {
$country=$row["country"];
$reg=$row["tot_reg"];
//add to data areray
$dataArray[$country]=$reg;
}
}
//configure graph
$graph->addData($dataArray);
$graph->setTitle("Tot registration per Country");
$graph->setGradient("lime", "green");
$graph->setBarOutlineColor("black");
$graph->createGraph();
?>
網頁(graph.html):
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Graph</title>
</head>
<body>
<h3>This is where I want to display my graph</h3>
<img src="graph.php" />
</body>
</html>
這是很簡單,但我得到了500內部服務器錯誤。 我知道PHP腳本是由服務器讀取的(如果我在PHP腳本上發現語義錯誤,我會在apache日誌中看到它),所以我不明白什麼是錯的。 SQL查詢正常,文件(Phpgraphlib.php,graph.html和graph.php)位於777權限(文件和目錄)的同一目錄中。
你能幫我嗎?
感謝 喬治