My website would display a picture, that gets sent in every second (refresh webpage) Yet, I realised that I had not installed PHP on my apache (which runs on a raspberry pi), so I did that and changed the directory from /var/www/html/index.php
to /var/www/index.php
and adjusted the paths etc.
Now if I want to display the site, I get a 500 error. In the log file stands this:
PHP Parse error: syntax error, unexpected 'else' (T_ELSE), expecting end of file in /var/www/html/index.php on line 26
And my index.php(the only file in the project) like this:
<html>
<head>
<title>Swissskills</title>
<link rel="stylesheet" href="css/stylesheet.css"/>
<link rel="icon" href="pictures/post.jpg">
<meta http-equiv="refresh" content="2.1">
</head>
<body>
<div id="links">
<h1 id="title">Webcam</h1>
<?php
/*
$timestamp --> findet letzte Änderung der Datei heraus (nicht in lesbarer Uhrzeit formatiert --> alles in sec)
$time --> liest aktuelle Zeit
$diff --> differenz in sec
*/
$dateinamen = 'pictures/Live.jpg';
$timestamp = filemtime($dateinamen);
$time = time();
$diff = $time -$timestamp;
// Wenn Bild jünger als 2sec
if ($diff < 2)
echo "<img src='pictures/Live.jpg'";
sleep(2);
else
echo "<img src='pictures/oops.jpg'";
?>
</div>
<div id="rechts">
<h2>Ping</h2>
<?php
/*exec (wie in Kommandozeile)
ping (normal) -n (Anzahl Pakete) -w (Wartezeit für gesendete Pakete)
$host (Hostname/IP-Adresse)
$output (Detailinfos wie in Kommandozeile)
$result (0 = vorhanden; 1 = nicht vorhanden)
*/
$host1="192.168.1.1";
exec("ping -n 1 -w 1 " . $host1, $output1, $result1);
if ($result1 == 0)
echo "<h3 id='sw1'style='background-color: green';>Router</h3></br>";
else
echo "<h3 id='sw1'style='background-color: red';>Router</h3></br>";
$host2="192.168.1.10";
exec("ping -n 1 -w 1 " . $host2, $output2, $result2);
if ($result2 == 0)
echo "<h3 id='sw2'style='background-color: green';>Switch 1</h3></br>";
else
echo "<h3 id='sw2'style='background-color: red';>Switch 1</h3></br>";
$host3="192.168.1.11";
exec("ping -n 1 -w 1 " . $host3, $output3, $result3);
if ($result3 == 0)
echo "<h3 id='sw3'style='background-color: green';>Switch 2</h3></br>";
else
echo "<h3 id='sw3'style='background-color: red';>Switch 2</h3></br>";
?>
</div>
</body>
Any help is appreciated.