{"id":5052,"date":"2025-11-12T09:41:54","date_gmt":"2025-11-12T08:41:54","guid":{"rendered":"https:\/\/workboot.fr\/ciela\/?page_id=5052"},"modified":"2025-12-08T17:28:05","modified_gmt":"2025-12-08T16:28:05","slug":"rpi_4-php-et-gpio","status":"publish","type":"page","link":"https:\/\/workboot.fr\/ciela\/rpi_4-php-et-gpio\/","title":{"rendered":"RPI_4 PHP et GPIO"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\ud83d\udd52 : 3 h maximum<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"alignright size-full is-resized\"><a href=\"https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/GPIO27.png\"><img loading=\"lazy\" decoding=\"async\" width=\"925\" height=\"638\" src=\"https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/GPIO27.png\" alt=\"\" class=\"wp-image-5164\" style=\"aspect-ratio:1.4498553121124431;width:403px;height:auto\" srcset=\"https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/GPIO27.png 925w, https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/GPIO27-300x207.png 300w, https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/GPIO27-768x530.png 768w\" sizes=\"auto, (max-width: 925px) 100vw, 925px\" \/><\/a><\/figure>\n<\/div>\n\n\n<div class=\"wp-block-group is-nowrap is-layout-flex wp-container-core-group-is-layout-8f761849 wp-block-group-is-layout-flex\">\n<nav aria-label=\"Table des mati\u00e8res\" class=\"wp-block-table-of-contents\"><ol><li><a class=\"wp-block-table-of-contents__entry\" href=\"https:\/\/workboot.fr\/ciela\/rpi_4-php-et-gpio\/#prerequis\">Pr\u00e9requis:<\/a><\/li><li><a class=\"wp-block-table-of-contents__entry\" href=\"https:\/\/workboot.fr\/ciela\/rpi_4-php-et-gpio\/#but\">But:<\/a><\/li><li><a class=\"wp-block-table-of-contents__entry\" href=\"https:\/\/workboot.fr\/ciela\/rpi_4-php-et-gpio\/#repertoire-de-travail-compte-rendu-et-fichiers-de-l-application\">R\u00e9pertoire de travail: <\/a><\/li><li><a class=\"wp-block-table-of-contents__entry\" href=\"https:\/\/workboot.fr\/ciela\/rpi_4-php-et-gpio\/#installation-des-outils-logiciels\">Installation des outils logiciels:<\/a><\/li><li><a class=\"wp-block-table-of-contents__entry\" href=\"https:\/\/workboot.fr\/ciela\/rpi_4-php-et-gpio\/#se-faire-un-environnement-de-developpement-web-pour-user\">Se faire un environnement de d\u00e9veloppement WEB pour $USER<\/a><\/li><li><a class=\"wp-block-table-of-contents__entry\" href=\"https:\/\/workboot.fr\/ciela\/rpi_4-php-et-gpio\/#reglage-firefox-pour-acceder-a-votre-rpi\">R\u00e9glage firefox pour acc\u00e9der \u00e0 votre RPI<\/a><\/li><li><a class=\"wp-block-table-of-contents__entry\" href=\"https:\/\/workboot.fr\/ciela\/rpi_4-php-et-gpio\/#premiere-page-html\">Premi\u00e8re page html<\/a><ol><li><a class=\"wp-block-table-of-contents__entry\" href=\"https:\/\/workboot.fr\/ciela\/rpi_4-php-et-gpio\/#visualiser-la-page-html-sur-le-serveur-apache-de-votre-rpi\">Visualiser la page html sur le serveur apache de votre  RPI<\/a><\/li><li><a class=\"wp-block-table-of-contents__entry\" href=\"https:\/\/workboot.fr\/ciela\/rpi_4-php-et-gpio\/#dans-un-terminal-on-peut-recuperer-le-fichier-html\">Dans un terminal on peut r\u00e9cup\u00e9rer le fichier html<\/a><\/li><\/ol><\/li><li><a class=\"wp-block-table-of-contents__entry\" href=\"https:\/\/workboot.fr\/ciela\/rpi_4-php-et-gpio\/#decouvrons-ou-redecouvrons-php\">D\u00e9couvrons ou red\u00e9couvrons PHP<\/a><\/li><li><a class=\"wp-block-table-of-contents__entry\" href=\"https:\/\/workboot.fr\/ciela\/rpi_4-php-et-gpio\/#comment-utiliser-php-et-libgpiod\">Comment utiliser php et libgpiod<\/a><ol><li><a class=\"wp-block-table-of-contents__entry\" href=\"https:\/\/workboot.fr\/ciela\/rpi_4-php-et-gpio\/#allumer-gpio27-en-php\">allumer GPIO27 en php<\/a><\/li><li><a class=\"wp-block-table-of-contents__entry\" href=\"https:\/\/workboot.fr\/ciela\/rpi_4-php-et-gpio\/#tester-le-script-php-allume-php\">Tester le script php allume.php<\/a><\/li><li><a class=\"wp-block-table-of-contents__entry\" href=\"https:\/\/workboot.fr\/ciela\/rpi_4-php-et-gpio\/#eteindre-gpio27-en-php\">Eteindre GPIO27 en php<\/a><\/li><li><a class=\"wp-block-table-of-contents__entry\" href=\"https:\/\/workboot.fr\/ciela\/rpi_4-php-et-gpio\/#tester-le-script-php-allume-php\">Tester le script php eteint.php<\/a><\/li><\/ol><\/li><li><a class=\"wp-block-table-of-contents__entry\" href=\"https:\/\/workboot.fr\/ciela\/rpi_4-php-et-gpio\/#nous-allons-commencer-notre-site-pour-gerer-gpio27-en-ligne\">Nous allons commencer notre site pour g\u00e9rer GPIO27 en ligne<\/a><ol><li><a class=\"wp-block-table-of-contents__entry\" href=\"https:\/\/workboot.fr\/ciela\/rpi_4-php-et-gpio\/#dans-quel-langage-est-realise-la-function-callphp-script\">Dans quel langage est r\u00e9alis\u00e9 la function callPHP(script)<\/a><\/li><li><a class=\"wp-block-table-of-contents__entry\" href=\"https:\/\/workboot.fr\/ciela\/rpi_4-php-et-gpio\/#les-scripts-php-pour-utiliser-la-libgpiod\">Les scripts PHP pour utiliser la libgpiod<\/a><\/li><li><a class=\"wp-block-table-of-contents__entry\" href=\"https:\/\/workboot.fr\/ciela\/rpi_4-php-et-gpio\/#allume-php-cli-web\">allume.php  cli \/ web<\/a><\/li><li><a class=\"wp-block-table-of-contents__entry\" href=\"https:\/\/workboot.fr\/ciela\/rpi_4-php-et-gpio\/#inspecteur\">inspecteur<\/a><\/li><li><a class=\"wp-block-table-of-contents__entry\" href=\"https:\/\/workboot.fr\/ciela\/rpi_4-php-et-gpio\/#reseau\">R\u00e9seau<\/a><\/li><\/ol><\/li><li><a class=\"wp-block-table-of-contents__entry\" href=\"https:\/\/workboot.fr\/ciela\/rpi_4-php-et-gpio\/#ameliorons-notre-applicatif-web\">Am\u00e9liorons notre applicatif web<\/a><\/li><li><a class=\"wp-block-table-of-contents__entry\" href=\"https:\/\/workboot.fr\/ciela\/rpi_4-php-et-gpio\/#utilisons-les-consoles\">utilisons les consoles  <\/a><\/li><li><a class=\"wp-block-table-of-contents__entry\" href=\"https:\/\/workboot.fr\/ciela\/rpi_4-php-et-gpio\/#provoquons-un-erreur\">Provoquons un erreur <\/a><\/li><\/ol><\/nav>\n<\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"prerequis\">Pr\u00e9requis:<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Dev WEB , html , php , javascript , serveur web (apache) <\/li>\n\n\n\n<li>libgpiod <\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"but\">But:<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Mise en place d&rsquo;un serveur web (apache) et d\u2019application en langage  php, html et javascript<\/li>\n\n\n\n<li>R\u00e9aliser une application WEB pour piloter un GPIO (ici GPIO27)<\/li>\n\n\n\n<li>configuration de firefox pour acc\u00e9der \u00e0 notre Raspberry Pi<\/li>\n\n\n\n<li>Utilisation de l&rsquo;outil de d\u00e9veloppement du navigateur (ici Firefox)<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"repertoire-de-travail-compte-rendu-et-fichiers-de-l-application\">R\u00e9pertoire de travail: <\/h2>\n\n\n\n<p class=\"wp-block-paragraph\" id=\"repertoire-de-travail-compte-rendu-et-fichiers-de-l-application\">(compte rendu et fichiers de l&rsquo;application)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>~\/Works\/RPI_4<\/strong><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"installation-des-outils-logiciels\">Installation des outils logiciels:<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">apache , et php et gpiod  <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt update\nsudo apt install apache2 php libapache2-mod-php php-cli\nsudo apt install gpiod php-gd  # php-gd est souvent utile pour les projets web<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"se-faire-un-environnement-de-developpement-web-pour-user\">Se faire un environnement de d\u00e9veloppement WEB pour $USER<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">configuration pour autoriser l&rsquo;usage du gpio par le groupe www-data et par le $user<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo groupadd gpio\nsudo usermod -a -G gpio www-data\nsudo usermod -a -G gpio $USER  # Remplacez $USER par votre nom d'utilisateur si n\u00e9cessaire\n# Ajouter votre user au groupe www-data\nsudo usermod -a -G www-data $USER\n\n# Red\u00e9marrer la session ou faire un login\nnewgrp www-data\n# OU se d\u00e9connecter\/reconnecter\n\n# V\u00e9rifier que vous \u00eates dans le groupe\ngroups\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">rendre le r\u00e9pertoire \/var\/www\/html  disponible pour les utilisateurs du groupe www-data<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Plus besoin de faire de sudo pour acc\u00e9der \u00e0 ce r\u00e9pertoire<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Aller dans le dossier web\ncd \/var\/www\n\n# Donner les permissions au groupe www-data\nsudo chown -R www-data:www-data html\/\nsudo chmod -R 775 html\/<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">V\u00e9rifier que vous pouvez faire du d\u00e9veloppement web  avec votre compte.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"reglage-firefox-pour-acceder-a-votre-rpi\">R\u00e9glage firefox pour acc\u00e9der \u00e0 votre RPI<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">firefox est configur\u00e9 pour passer \u00e0 travers le proxy du lyc\u00e9e. (10.0.0.1:3128)  (sur la photo ci dessous pas de proxy la \u00e7a va fonctionner, mais nous voulons utiliser firefox pour aller sur internet ! Donc nous laisserons la configuration manuelle du proxy.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Et la nous avons besoin d\u2019acc\u00e9der \u00e0 notre RPI  qui est a l&rsquo;adresse 172.22.50.XXX<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">XXX : 101 pour le poste 1 et XXX:114 pour le poste 14 (distribu\u00e9 par le serveur DHCP de la section)<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/firefox_pas-de-proxy.png\"><img loading=\"lazy\" decoding=\"async\" width=\"762\" height=\"538\" src=\"https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/firefox_pas-de-proxy.png\" alt=\"\" class=\"wp-image-5067\" srcset=\"https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/firefox_pas-de-proxy.png 762w, https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/firefox_pas-de-proxy-300x212.png 300w\" sizes=\"auto, (max-width: 762px) 100vw, 762px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">il faudra exclure les adresses internes du r\u00e9seau local ! et garder la configuration manuelle.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/pas_proxy.png\"><img loading=\"lazy\" decoding=\"async\" width=\"731\" height=\"150\" src=\"https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/pas_proxy.png\" alt=\"\" class=\"wp-image-5068\" srcset=\"https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/pas_proxy.png 731w, https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/pas_proxy-300x62.png 300w\" sizes=\"auto, (max-width: 731px) 100vw, 731px\" \/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"premiere-page-html\">Premi\u00e8re page html<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Nous allons tester notre serveur web (dans le Raspberry Pi)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">index.html<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"html\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;!DOCTYPE html>\n&lt;html lang=\"fr\">\n&lt;head>\n    &lt;meta charset=\"UTF-8\">\n    &lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    &lt;title>Ma premi\u00e8re page&lt;\/title>\n&lt;\/head>\n&lt;body>\n    &lt;h1>bonjour le monde&lt;\/h1>\n&lt;\/body>\n&lt;\/html><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">et du navigateur on peut voir cette page <\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"visualiser-la-page-html-sur-le-serveur-apache-de-votre-rpi\">Visualiser la page html sur le serveur apache de votre  RPI<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">dans votre firefox configur\u00e9 correctement pour le lycee:<strong> http:\/\/raspiYXX.local<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/firefox_bonjour.png\"><img loading=\"lazy\" decoding=\"async\" width=\"859\" height=\"450\" src=\"https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/firefox_bonjour.png\" alt=\"\" class=\"wp-image-5076\" srcset=\"https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/firefox_bonjour.png 859w, https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/firefox_bonjour-300x157.png 300w, https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/firefox_bonjour-768x402.png 768w\" sizes=\"auto, (max-width: 859px) 100vw, 859px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">c&rsquo;est bien votre serveur web apache qui r\u00e9pond<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Dans firefox on peut voir le html, dans outils suppl\u00e9mentaires, et outils de d\u00e9veloppement<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/mapremierepageweb.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"504\" src=\"https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/mapremierepageweb-1024x504.png\" alt=\"\" class=\"wp-image-5079\" srcset=\"https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/mapremierepageweb-1024x504.png 1024w, https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/mapremierepageweb-300x148.png 300w, https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/mapremierepageweb-768x378.png 768w, https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/mapremierepageweb.png 1377w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"dans-un-terminal-on-peut-recuperer-le-fichier-html\">Dans un terminal on peut r\u00e9cup\u00e9rer le fichier html<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">vous pouvez r\u00e9cup\u00e9rer le fichier html (sans passer par firefox qui peut l\u2019interpr\u00e9ter)<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>bruno@elliott:~$ <strong>wget 172.22.50.101<\/strong>\n--2025-11-12 17:11:44--  http:\/\/172.22.50.101\/\nConnexion \u00e0 172.22.50.101:80\u2026 connect\u00e9.\nrequ\u00eate HTTP transmise, en attente de la r\u00e9ponse\u2026 200 OK\nTaille&nbsp;: 240 &#91;text\/html]\nSauvegarde en&nbsp;: \u00ab&nbsp;index.html&nbsp;\u00bb\n\n<strong>index.html<\/strong>                         100%&#91;================================================================&gt;]     240  --.-KB\/s    ds 0s      \n\n2025-11-12 17:11:45 (11,8 MB\/s) \u2014 \u00ab&nbsp;index.html&nbsp;\u00bb sauvegard\u00e9 &#91;240\/240]<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"decouvrons-ou-redecouvrons-php\">D\u00e9couvrons ou red\u00e9couvrons PHP<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">on va mettre ce script bonjour.php   sur notre RPI (dans le r\u00e9pertoire du TP)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">nous allons v\u00e9rifier que php (interpr\u00e8teur de  php) est fonctionnel<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>bonjour.php<\/strong>:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"php\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;?php\n\/\/ bonjour le monde !!\necho \"Bonjour le monde !\\n\";\n?><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Nous allons le tester:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>bruno@work:~\/Works\/web_php_gpio\/php $ php bonjour.php \nBonjour le monde !\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"comment-utiliser-php-et-libgpiod\">Comment utiliser php et libgpiod<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">on va mettre une led sur GPIO 27 , v\u00e9rifier que le montage fonctionne (avec gpioset)<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"allumer-gpio27-en-php\">allumer GPIO27 en php<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">allume.php<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"php\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;?php\necho \"\ud83d\udca1 Allumage GPIO27\\n\";\nsystem(\"gpioset gpiochip0 27=1\");\nfile_put_contents('\/tmp\/gpio27_etat.txt', '1');\necho \"\u2705 GPIO27 allum\u00e9e\\n\";\n\nexit(0);\n?><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">la fonction <strong>system<\/strong> , nous permet d&rsquo;utiliser <strong>gpioset<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">cette fonction permet d\u2019ex\u00e9cuter n&rsquo;importe quelle fonction de notre syst\u00e8me.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Et  file_put_contents , va nous permettre de sauvegarder l&rsquo;\u00e9tat de GPIO27 , dans \/tmp\/gpio27_etat.txt <\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"tester-le-script-php-allume-php\">Tester le script php allume.php<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>verifier que la led sur GPIO27 s&rsquo;allume <\/li>\n\n\n\n<li>v\u00e9rifier le contenu du fichier  \/tmp\/gpio27_etat.txt<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"eteindre-gpio27-en-php\">Eteindre GPIO27 en php<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">eteint.php<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;?php\n\/\/ Eteindre GPIO27\necho \"\ud83d\udd35 Extinction GPIO27\\n\";\nsystem(\"gpioset gpiochip0 27=0\");\nfile_put_contents('\/tmp\/gpio27_etat.txt', '0');\necho \"\u2705 GPIO27 Eteint\\n\";\n\nexit(0);\n?>\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"tester-le-script-php-allume-php\">Tester le script php eteint.php<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>verifier que la led sur GPIO27 s&rsquo;\u00e9teint<\/li>\n\n\n\n<li>v\u00e9rifier le contenu du fichier  \/tmp\/gpio27_etat.txt<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"nous-allons-commencer-notre-site-pour-gerer-gpio27-en-ligne\">Nous allons commencer notre site pour g\u00e9rer GPIO27 en ligne<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Sur nos Raspberry Pi , le site web est configur\u00e9 par d\u00e9faut dans <strong>\/var\/www\/html<\/strong> <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">on rappel que <strong>index.html <\/strong>est le premier fichier recherch\u00e9 sur le serveur.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Dans lequel vous devez trouver un fichier index.html  que vous devez comprendre et utiliser en le visualisant dans votre navigateur (firefox) rpiYXX.local , une fois que cela est fait renommer cet index.html en index.html.bak   <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Ici en javascript et html: notre nouveau index.html<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">index.html<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"html\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;!DOCTYPE html>\n&lt;html>\n&lt;head>\n    &lt;meta charset=\"UTF-8\">\n    &lt;title>Test GPIO&lt;\/title>\n&lt;\/head>\n&lt;body>\n    &lt;h1>Test GPIO27&lt;\/h1>\n    \n    &lt;div id=\"output\" style=\"padding:20px; border:1px solid #000; margin:20px;\">&lt;\/div>\n    \n    &lt;button onclick=\"callPHP('allume.php')\">ALLUMER&lt;\/button>\n    &lt;button onclick=\"callPHP('eteint.php')\">ETEINDRE&lt;\/button>\n    &lt;button onclick=\"callPHP('statut.php')\">STATUT&lt;\/button>\n\n    &lt;script>\n        function callPHP(script) {\n            const output = document.getElementById('output');\n            output.innerHTML = 'Appel de ' + script + '...';\n            \n            fetch(script)\n                .then(response => {\n                    output.innerHTML += '&lt;br>Status: ' + response.status;\n                    return response.text();\n                })\n                .then(text => {\n                    output.innerHTML += '&lt;br>R\u00e9ponse: ' + text;\n                })\n                .catch(error => {\n                    output.innerHTML += '&lt;br>ERREUR: ' + error;\n                });\n        }\n    &lt;\/script>\n&lt;\/body>\n&lt;\/html><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"dans-quel-langage-est-realise-la-function-callphp-script\">Dans quel langage est r\u00e9alis\u00e9 la function callPHP(script)<\/h3>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"les-scripts-php-pour-utiliser-la-libgpiod\">Les scripts PHP pour utiliser la libgpiod<\/h3>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"allume-php-cli-web\">allume.php  cli \/ web<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">cli : utilisable en ligne de commande  (php allume.php)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">web :  utilisable par le navigateur web<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>allume.php<\/strong>  (a placer dans \/var\/www\/html)<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"php\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;?php\n\/\/ allume.php\nif (php_sapi_name() === 'cli') {\n    echo \"\ud83d\udca1 Allumage GPIO27\\n\";\n    system(\"gpioset gpiochip0 27=1\");\n    file_put_contents('\/tmp\/gpio27_etat.txt', '1');\n    echo \"\u2705 GPIO27 allum\u00e9e\\n\";\n} else {\n    system(\"gpioset gpiochip0 27=1\");\n    file_put_contents('\/tmp\/gpio27_etat.txt', '1');\n    header('Content-Type: application\/json');\n    echo json_encode([\n        'status' => 'success',\n        'message' => \"GPIO27 allum\u00e9e\",\n        'gpio' => 27,\n        'value' => 1,\n        'timestamp' => date('Y-m-d H:i:s')\n    ]);\n}\n?><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>eteint.php<\/strong> (a placer dans \/var\/www\/html)<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"php\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;?php\n\/\/ eteint.php\nif (php_sapi_name() === 'cli') {\n    echo \"\u26ab Extinction GPIO27\\n\";\n    system(\"gpioset gpiochip0 27=0\");\n    file_put_contents('\/tmp\/gpio27_etat.txt', '0');\n    echo \"\u2705 GPIO27 \u00e9teinte\\n\";\n} else {\n    system(\"gpioset gpiochip0 27=0\");\n    file_put_contents('\/tmp\/gpio27_etat.txt', '0');\n    header('Content-Type: application\/json');\n    echo json_encode([\n        'status' => 'success',\n        'message' => \"GPIO27 \u00e9teinte\",\n        'gpio' => 27,\n        'value' => 0,\n        'timestamp' => date('Y-m-d H:i:s')\n    ]);\n}\n?><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>statut.php<\/strong> (a placer dans \/var\/www\/html)<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"php\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;?php\n\/\/ statut_sans_affecter.php - M\u00e9morisation de l'\u00e9tat\n\n$state_file = '\/tmp\/gpio27_etat.txt';\n\nif (php_sapi_name() === 'cli') {\n    echo \"\ud83d\udce1 \u00c9tat m\u00e9moris\u00e9 GPIO27...\\n\";\n    \n    if (file_exists($state_file)) {\n        $etat = trim(file_get_contents($state_file));\n        if ($etat === '1') {\n            echo \"\ud83d\udd34 GPIO27: ALLUM\u00c9E (dernier \u00e9tat connu)\\n\";\n        } else {\n            echo \"\u26ab GPIO27: \u00c9TEINTE (dernier \u00e9tat connu)\\n\";\n        }\n    } else {\n        echo \"\u2753 \u00c9tat inconnu - Ex\u00e9cutez allume.php ou eteint.php d'abord\\n\";\n    }\n    \n} else {\n    if (file_exists($state_file)) {\n        $etat = trim(file_get_contents($state_file));\n        $value_int = intval($etat);\n        $message = $value_int === 1 ? \"GPIO27 allum\u00e9e\" : \"GPIO27 \u00e9teinte\";\n    } else {\n        $value_int = 0;\n        $message = \"\u00c9tat inconnu\";\n    }\n    \n    header('Content-Type: application\/json');\n    echo json_encode([\n        'status' => 'success',\n        'message' => $message,\n        'gpio' => 27,\n        'value' => $value_int,\n        'timestamp' => date('Y-m-d H:i:s')\n    ]);\n}\n?>\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Ouvrir les DevTools<br><strong>F12<\/strong> ou Ctrl+Shift+I<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Ou clic droit \u2192 \u00ab\u00a0Inspecter\u00a0\u00bb<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"inspecteur\">inspecteur<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">on voit la structure de notre page web<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"reseau\">R\u00e9seau<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">on va y voir nos requ\u00eates<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">rafra\u00eechir (la fl\u00e8che qui tourne)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">S\u00e9lectionner XHR ou et  fetch<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/XHR.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"642\" src=\"https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/XHR-1024x642.png\" alt=\"\" class=\"wp-image-5141\" srcset=\"https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/XHR-1024x642.png 1024w, https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/XHR-300x188.png 300w, https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/XHR-768x481.png 768w, https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/XHR.png 1533w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">on active bouton allumer !<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/XHR_allume.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"642\" src=\"https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/XHR_allume-1024x642.png\" alt=\"\" class=\"wp-image-5143\" srcset=\"https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/XHR_allume-1024x642.png 1024w, https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/XHR_allume-300x188.png 300w, https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/XHR_allume-768x481.png 768w, https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/XHR_allume.png 1533w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">on peut voir la r\u00e9ponse au format Json : l&rsquo;outil de d\u00e9veloppement int\u00e9gr\u00e9 est le bienvenu !<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/dev.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"642\" src=\"https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/dev-1024x642.png\" alt=\"\" class=\"wp-image-5145\" srcset=\"https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/dev-1024x642.png 1024w, https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/dev-300x188.png 300w, https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/dev-768x481.png 768w, https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/dev.png 1533w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"ameliorons-notre-applicatif-web\">Am\u00e9liorons notre applicatif web<\/h2>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/control.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"642\" src=\"https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/control-1024x642.png\" alt=\"\" class=\"wp-image-5151\" srcset=\"https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/control-1024x642.png 1024w, https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/control-300x188.png 300w, https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/control-768x481.png 768w, https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/control.png 1533w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>control.html<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"html\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;!DOCTYPE html>\n&lt;html>\n&lt;head>\n    &lt;meta charset=\"UTF-8\">\n    &lt;title>Contr\u00f4le GPIO27&lt;\/title>\n    &lt;style>\n        body {\n            font-family: Arial, sans-serif;\n            max-width: 500px;\n            margin: 40px auto;\n            padding: 20px;\n            text-align: center;\n        }\n        .status {\n            padding: 20px;\n            margin: 20px 0;\n            border-radius: 8px;\n            font-size: 18px;\n            font-weight: bold;\n        }\n        .on { background: #d4edda; color: #155724; border: 2px solid #c3e6cb; }\n        .off { background: #f8d7da; color: #721c24; border: 2px solid #f5c6cb; }\n        button {\n            padding: 15px 25px;\n            margin: 10px;\n            font-size: 16px;\n            border: none;\n            border-radius: 5px;\n            cursor: pointer;\n            color: white;\n        }\n        .btn-on { background: #28a745; }\n        .btn-off { background: #dc3545; }\n        .btn-status { background: #17a2b8; }\n        #message { margin: 15px 0; color: #666; }\n    &lt;\/style>\n&lt;\/head>\n&lt;body>\n    &lt;h1>Contr\u00f4le GPIO27&lt;\/h1>\n    \n    &lt;div id=\"status\" class=\"status off\">Statut: Chargement...&lt;\/div>\n    \n    &lt;button class=\"btn-on\" onclick=\"allumer()\">Allumer&lt;\/button>\n    &lt;button class=\"btn-off\" onclick=\"eteindre()\">\u00c9teindre&lt;\/button>\n    &lt;button class=\"btn-status\" onclick=\"getStatut()\">Actualiser&lt;\/button>\n    \n    &lt;div id=\"message\">&lt;\/div>\n\n    &lt;script>\n        \/\/ Fonctions corrig\u00e9es\n        function showMessage(text, isError = false) {\n            const messageDiv = document.getElementById('message');\n            messageDiv.textContent = text;\n            messageDiv.style.color = isError ? '#dc3545' : '#28a745';\n        }\n\n        function updateStatus(message, isOn) {\n            const statusDiv = document.getElementById('status');\n            statusDiv.textContent = message;\n            statusDiv.className = 'status ' + (isOn ? 'on' : 'off');\n        }\n\n        async function allumer() {\n            showMessage('Allumage en cours...');\n            try {\n                const response = await fetch('allume.php');\n                if (!response.ok) throw new Error('HTTP error: ' + response.status);\n                const data = await response.json();\n                updateStatus('ALLUM\u00c9E', true);\n                showMessage('\u2705 ' + data.message);\n            } catch (error) {\n                console.error('Erreur allumage:', error);\n                updateStatus('ERREUR', false);\n                showMessage('\u274c Erreur: ' + error.message, true);\n            }\n        }\n\n        async function eteindre() {\n            showMessage('Extinction en cours...');\n            try {\n                const response = await fetch('eteint.php');\n                if (!response.ok) throw new Error('HTTP error: ' + response.status);\n                const data = await response.json();\n                updateStatus('\u00c9TEINTE', false);\n                showMessage('\u2705 ' + data.message);\n            } catch (error) {\n                console.error('Erreur extinction:', error);\n                updateStatus('ERREUR', false);\n                showMessage('\u274c Erreur: ' + error.message, true);\n            }\n        }\n\n        async function getStatut() {\n            showMessage('Lecture du statut...');\n            try {\n                const response = await fetch('statut.php');\n                if (!response.ok) throw new Error('HTTP error: ' + response.status);\n                const data = await response.json();\n                updateStatus(data.message.toUpperCase(), data.value === 1);\n                showMessage('\u2705 Statut actualis\u00e9');\n            } catch (error) {\n                console.error('Erreur statut:', error);\n                updateStatus('HORS LIGNE', false);\n                showMessage('\u274c Erreur de connexion', true);\n            }\n        }\n\n        \/\/ Charger le statut au d\u00e9marrage\n        document.addEventListener('DOMContentLoaded', getStatut);\n    &lt;\/script>\n&lt;\/body>\n&lt;\/html><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"utilisons-les-consoles\">utilisons les consoles  <\/h2>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"html\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;!DOCTYPE html>\n&lt;html>\n&lt;head>\n    &lt;meta charset=\"UTF-8\">\n    &lt;title>Contr\u00f4le GPIO27 - Version Console&lt;\/title>\n    &lt;style>\n        body {\n            font-family: Arial, sans-serif;\n            max-width: 500px;\n            margin: 40px auto;\n            padding: 20px;\n            text-align: center;\n        }\n        .status {\n            padding: 20px;\n            margin: 20px 0;\n            border-radius: 8px;\n            font-size: 18px;\n            font-weight: bold;\n        }\n        .on { background: #d4edda; color: #155724; border: 2px solid #c3e6cb; }\n        .off { background: #f8d7da; color: #721c24; border: 2px solid #f5c6cb; }\n        button {\n            padding: 15px 25px;\n            margin: 10px;\n            font-size: 16px;\n            border: none;\n            border-radius: 5px;\n            cursor: pointer;\n            color: white;\n        }\n        .btn-on { background: #28a745; }\n        .btn-off { background: #dc3545; }\n        .btn-status { background: #17a2b8; }\n        #message { margin: 15px 0; color: #666; }\n    &lt;\/style>\n&lt;\/head>\n&lt;body>\n    &lt;h1>Contr\u00f4le GPIO27 - Version Console&lt;\/h1>\n    &lt;p style=\"color: #666; font-size: 14px;\">Ouvrez la console (F12) pour voir les logs d\u00e9taill\u00e9s&lt;\/p>\n    \n    &lt;div id=\"status\" class=\"status off\">Statut: Chargement...&lt;\/div>\n    \n    &lt;button class=\"btn-on\" onclick=\"allumer()\">Allumer&lt;\/button>\n    &lt;button class=\"btn-off\" onclick=\"eteindre()\">\u00c9teindre&lt;\/button>\n    &lt;button class=\"btn-status\" onclick=\"getStatut()\">Actualiser&lt;\/button>\n    \n    &lt;div id=\"message\">&lt;\/div>\n\n    &lt;script>\n        \/\/ Fonction utilitaire pour les logs avec timestamp\n        function log(action, message) {\n            const timestamp = new Date().toLocaleTimeString();\n            console.log(`[${timestamp}] ${action}: ${message}`);\n        }\n\n        function showMessage(text, isError = false) {\n            const messageDiv = document.getElementById('message');\n            messageDiv.textContent = text;\n            messageDiv.style.color = isError ? '#dc3545' : '#28a745';\n        }\n\n        function updateStatus(message, isOn) {\n            const statusDiv = document.getElementById('status');\n            statusDiv.textContent = message;\n            statusDiv.className = 'status ' + (isOn ? 'on' : 'off');\n        }\n\n        async function allumer() {\n            console.group('\ud83d\ude80 ALLUMAGE GPIO27');\n            log('D\u00c9BUT', 'Fonction allumer() appel\u00e9e');\n            \n            showMessage('Allumage en cours...');\n            \n            try {\n                log('REQU\u00caTE', 'Envoi vers allume.php');\n                const response = await fetch('allume.php');\n                \n                log('R\u00c9PONSE', `Status HTTP: ${response.status}`);\n                if (!response.ok) throw new Error('HTTP error: ' + response.status);\n                \n                const data = await response.json();\n                log('DONN\u00c9ES', `JSON re\u00e7u: ${JSON.stringify(data)}`);\n                log('GPIO', `Valeur: ${data.value}`);\n                \n                updateStatus('ALLUM\u00c9E', true);\n                showMessage('\u2705 ' + data.message);\n                \n                log('SUCC\u00c8S', 'Interface mise \u00e0 jour');\n                \n            } catch (error) {\n                log('ERREUR', error.message);\n                console.error('\ud83d\udca5 D\u00e9tails erreur:', error);\n                updateStatus('ERREUR', false);\n                showMessage('\u274c Erreur: ' + error.message, true);\n            }\n            \n            console.groupEnd();\n        }\n\n        async function eteindre() {\n            console.group('\ud83d\udd0c EXTINCTION GPIO27');\n            log('D\u00c9BUT', 'Fonction eteindre() appel\u00e9e');\n            \n            showMessage('Extinction en cours...');\n            \n            try {\n                log('REQU\u00caTE', 'Envoi vers eteint.php');\n                const response = await fetch('eteint.php');\n                \n                log('R\u00c9PONSE', `Status HTTP: ${response.status}`);\n                if (!response.ok) throw new Error('HTTP error: ' + response.status);\n                \n                const data = await response.json();\n                log('DONN\u00c9ES', `JSON re\u00e7u: ${JSON.stringify(data)}`);\n                log('GPIO', `Valeur: ${data.value}`);\n                \n                updateStatus('\u00c9TEINTE', false);\n                showMessage('\u2705 ' + data.message);\n                \n                log('SUCC\u00c8S', 'Interface mise \u00e0 jour');\n                \n            } catch (error) {\n                log('ERREUR', error.message);\n                console.error('\ud83d\udca5 D\u00e9tails erreur:', error);\n                updateStatus('ERREUR', false);\n                showMessage('\u274c Erreur: ' + error.message, true);\n            }\n            \n            console.groupEnd();\n        }\n\n        async function getStatut() {\n            console.group('\ud83d\udcca STATUT GPIO27');\n            log('D\u00c9BUT', 'Fonction getStatut() appel\u00e9e');\n            \n            showMessage('Lecture du statut...');\n            \n            try {\n                log('REQU\u00caTE', 'Envoi vers statut.php');\n                const response = await fetch('statut.php');\n                \n                log('R\u00c9PONSE', `Status HTTP: ${response.status}`);\n                if (!response.ok) throw new Error('HTTP error: ' + response.status);\n                \n                const data = await response.json();\n                log('DONN\u00c9ES', `JSON re\u00e7u: ${JSON.stringify(data)}`);\n                log('GPIO', `Valeur: ${data.value}, \u00c9tat: ${data.message}`);\n                \n                updateStatus(data.message.toUpperCase(), data.value === 1);\n                showMessage('\u2705 Statut actualis\u00e9');\n                \n                log('SUCC\u00c8S', 'Statut affich\u00e9');\n                \n            } catch (error) {\n                log('ERREUR', error.message);\n                console.error('\ud83d\udca5 D\u00e9tails erreur:', error);\n                updateStatus('HORS LIGNE', false);\n                showMessage('\u274c Erreur de connexion', true);\n            }\n            \n            console.groupEnd();\n        }\n\n        \/\/ Au chargement de la page\n        document.addEventListener('DOMContentLoaded', function() {\n            log('PAGE', 'Page charg\u00e9e - d\u00e9marrage automatique du statut');\n            getStatut();\n        });\n    &lt;\/script>\n&lt;\/body>\n&lt;\/html><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/control_consol.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"642\" src=\"https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/control_consol-1024x642.png\" alt=\"\" class=\"wp-image-5157\" srcset=\"https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/control_consol-1024x642.png 1024w, https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/control_consol-300x188.png 300w, https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/control_consol-768x481.png 768w, https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/control_consol.png 1533w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"provoquons-un-erreur\">Provoquons un erreur <\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">un jour il y aura des erreurs .. et la nous allons en provoquer une !<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">renommer le fichier eteint.php en etient.php.bak<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">et trouver le message d&rsquo;erreur dans la console  avec l&rsquo;outil de d\u00e9veloppement de firefox<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\ud83d\udd52 : 3 h maximum Pr\u00e9requis: But: R\u00e9pertoire de travail: (compte rendu et fichiers de l&rsquo;application) ~\/Works\/RPI_4 Installation des outils logiciels: apache , et php et gpiod Se faire un [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","_uag_custom_page_level_css":"","footnotes":""},"class_list":["post-5052","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>RPI_4 PHP et GPIO - workboot<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/workboot.fr\/ciela\/rpi_4-php-et-gpio\/\" \/>\n<meta property=\"og:locale\" content=\"fr_FR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"RPI_4 PHP et GPIO - workboot\" \/>\n<meta property=\"og:description\" content=\"\ud83d\udd52 : 3 h maximum Pr\u00e9requis: But: R\u00e9pertoire de travail: (compte rendu et fichiers de l&rsquo;application) ~\/Works\/RPI_4 Installation des outils logiciels: apache , et php et gpiod Se faire un [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/workboot.fr\/ciela\/rpi_4-php-et-gpio\/\" \/>\n<meta property=\"og:site_name\" content=\"workboot\" \/>\n<meta property=\"article:modified_time\" content=\"2025-12-08T16:28:05+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/GPIO27.png\" \/>\n\t<meta property=\"og:image:width\" content=\"925\" \/>\n\t<meta property=\"og:image:height\" content=\"638\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"twitter:label1\" content=\"Dur\u00e9e de lecture estim\u00e9e\" \/>\n\t<meta name=\"twitter:data1\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/rpi_4-php-et-gpio\\\/\",\"url\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/rpi_4-php-et-gpio\\\/\",\"name\":\"RPI_4 PHP et GPIO - workboot\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/rpi_4-php-et-gpio\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/rpi_4-php-et-gpio\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/wp-content\\\/uploads\\\/2025\\\/11\\\/GPIO27.png\",\"datePublished\":\"2025-11-12T08:41:54+00:00\",\"dateModified\":\"2025-12-08T16:28:05+00:00\",\"inLanguage\":\"fr-FR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/workboot.fr\\\/ciela\\\/rpi_4-php-et-gpio\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"fr-FR\",\"@id\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/rpi_4-php-et-gpio\\\/#primaryimage\",\"url\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/wp-content\\\/uploads\\\/2025\\\/11\\\/GPIO27.png\",\"contentUrl\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/wp-content\\\/uploads\\\/2025\\\/11\\\/GPIO27.png\",\"width\":925,\"height\":638},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/#website\",\"url\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/\",\"name\":\"workboot\",\"description\":\"Open Source, Open Minds \",\"publisher\":{\"@id\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"fr-FR\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/#organization\",\"name\":\"workboot\",\"url\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"fr-FR\",\"@id\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/wp-content\\\/uploads\\\/2025\\\/05\\\/logo_ciel-dorian-1.png\",\"contentUrl\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/wp-content\\\/uploads\\\/2025\\\/05\\\/logo_ciel-dorian-1.png\",\"width\":1024,\"height\":950,\"caption\":\"workboot\"},\"image\":{\"@id\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/#\\\/schema\\\/logo\\\/image\\\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"RPI_4 PHP et GPIO - workboot","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/workboot.fr\/ciela\/rpi_4-php-et-gpio\/","og_locale":"fr_FR","og_type":"article","og_title":"RPI_4 PHP et GPIO - workboot","og_description":"\ud83d\udd52 : 3 h maximum Pr\u00e9requis: But: R\u00e9pertoire de travail: (compte rendu et fichiers de l&rsquo;application) ~\/Works\/RPI_4 Installation des outils logiciels: apache , et php et gpiod Se faire un [&hellip;]","og_url":"https:\/\/workboot.fr\/ciela\/rpi_4-php-et-gpio\/","og_site_name":"workboot","article_modified_time":"2025-12-08T16:28:05+00:00","og_image":[{"width":925,"height":638,"url":"https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/GPIO27.png","type":"image\/png"}],"twitter_misc":{"Dur\u00e9e de lecture estim\u00e9e":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/workboot.fr\/ciela\/rpi_4-php-et-gpio\/","url":"https:\/\/workboot.fr\/ciela\/rpi_4-php-et-gpio\/","name":"RPI_4 PHP et GPIO - workboot","isPartOf":{"@id":"https:\/\/workboot.fr\/ciela\/#website"},"primaryImageOfPage":{"@id":"https:\/\/workboot.fr\/ciela\/rpi_4-php-et-gpio\/#primaryimage"},"image":{"@id":"https:\/\/workboot.fr\/ciela\/rpi_4-php-et-gpio\/#primaryimage"},"thumbnailUrl":"https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/GPIO27.png","datePublished":"2025-11-12T08:41:54+00:00","dateModified":"2025-12-08T16:28:05+00:00","inLanguage":"fr-FR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/workboot.fr\/ciela\/rpi_4-php-et-gpio\/"]}]},{"@type":"ImageObject","inLanguage":"fr-FR","@id":"https:\/\/workboot.fr\/ciela\/rpi_4-php-et-gpio\/#primaryimage","url":"https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/GPIO27.png","contentUrl":"https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/11\/GPIO27.png","width":925,"height":638},{"@type":"WebSite","@id":"https:\/\/workboot.fr\/ciela\/#website","url":"https:\/\/workboot.fr\/ciela\/","name":"workboot","description":"Open Source, Open Minds ","publisher":{"@id":"https:\/\/workboot.fr\/ciela\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/workboot.fr\/ciela\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"fr-FR"},{"@type":"Organization","@id":"https:\/\/workboot.fr\/ciela\/#organization","name":"workboot","url":"https:\/\/workboot.fr\/ciela\/","logo":{"@type":"ImageObject","inLanguage":"fr-FR","@id":"https:\/\/workboot.fr\/ciela\/#\/schema\/logo\/image\/","url":"https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/05\/logo_ciel-dorian-1.png","contentUrl":"https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/05\/logo_ciel-dorian-1.png","width":1024,"height":950,"caption":"workboot"},"image":{"@id":"https:\/\/workboot.fr\/ciela\/#\/schema\/logo\/image\/"}}]}},"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false},"uagb_author_info":{"display_name":"admin","author_link":"https:\/\/workboot.fr\/ciela\/author\/admin\/"},"uagb_comment_info":0,"uagb_excerpt":"\ud83d\udd52 : 3 h maximum Pr\u00e9requis: But: R\u00e9pertoire de travail: (compte rendu et fichiers de l&rsquo;application) ~\/Works\/RPI_4 Installation des outils logiciels: apache , et php et gpiod Se faire un [&hellip;]","_links":{"self":[{"href":"https:\/\/workboot.fr\/ciela\/wp-json\/wp\/v2\/pages\/5052","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/workboot.fr\/ciela\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/workboot.fr\/ciela\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/workboot.fr\/ciela\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/workboot.fr\/ciela\/wp-json\/wp\/v2\/comments?post=5052"}],"version-history":[{"count":38,"href":"https:\/\/workboot.fr\/ciela\/wp-json\/wp\/v2\/pages\/5052\/revisions"}],"predecessor-version":[{"id":5692,"href":"https:\/\/workboot.fr\/ciela\/wp-json\/wp\/v2\/pages\/5052\/revisions\/5692"}],"wp:attachment":[{"href":"https:\/\/workboot.fr\/ciela\/wp-json\/wp\/v2\/media?parent=5052"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}