Hallo,
I have a problem : I succeed to connect me on phpMyAdmin, but when I put a php file on my FTP in the repertory var/www of my Raspberry, and go to the URL I just have a white page. And when I use the extension .html (juste for seeing what happened) I have a server error. So did you know from where this error coming?
Here's my PHP file :
<?php
try
{
// On se connecte à MySQL
$bdd = new PDO('mysql:host=localhost;dbname=fhem;charset=utf8','MYID','MYPSWD');
}
catch(Exception $e)
{
// En cas d'erreur, on affiche un message et on arrête tout
die('Erreur : '.$e->getMessage());
}
// Si tout va bien, on peut continuer
// On récupère tout le contenu de la table current
$reponse = $bdd->query('SELECT * FROM current');
// On affiche chaque entrée une à une
while ($donnees = $reponse->fetch())
{
?>
<p>
<strong>DATE ET HEURE</strong> : <?php echo $donnees['TIMESTAMP']; ?><br />
Capteur : <?php echo $donnees['DEVICE']; ?> ; type : <?php echo $donnees['TYPE']; ?><br />
Evènement : <?php echo $donnees['EVENT']; ?> ; Ecriture : <?php echo $donnees['ECRITURE']; ?> <br />
Valeur : <?php echo $donnees['VALUE']; ?> ; Unité <?php echo $donnees['UNIT']; ?>
</p>
<?php
}
$reponse->closeCursor(); // Termine le traitement de la requête
?>
My connection is working
Thank you in advance
Grüße
Arsène
Hi Arsene,
which webserver is installed on your RPi?
Hi Jsloot,
I use Apache from Raspbian on my RPi
Please open a browser and open http://<hostname>/index.html. What do you see?
Here's what the error I see when I go on http://<hostname>/index.html :
(http://arsene-vauthier.com/Capture.JPG)
Maybe I have to open the 80 port ?
Problem solved!!
I just change the file permissions from 600 to 644 and now I can see them!
Thank you for guidance :)
Have a nice day!
Arsène