How to read GPIO data from a PHP file?

Die benötigte Hardware zum Nachbau. Bitte hier nur Hardware posten, die man auch selber ausprobiert hat. Nichts posten, nur weil es neu ist.

Moderator: Ulrich

Forumsregeln
Bitte nur Hardware posten, die man selber auch ausprobiert bzw. in Verwendung hat.
annabellerice
Beiträge: 1
Registriert: Do 29. Jan 2026, 03:13

How to read GPIO data from a PHP file?

Beitrag von annabellerice »

I have a PHP code snippet written on a slightly older Raspberry Pi 4 and want to run it on a Raspberry Pi 5 with 8GB of RAM.

Of course, I've downloaded and installed the latest software.

It runs and the data is displayed. However, my additional application no longer works.

This application reads and writes input and output data from the code snippet. Previously, I used the PHP command:

`$fp = fopen("sys/class//gpio/gpio4/value","r");

$Var= fread($fp,1) + 0
fclose($fp)`
to read a range

, or `
shell_exec("echo $pin1 >/sys/class/gpio/gpio2/value");`.

Does anyone know the current programming commands to read and write GPIO?

Zurück zu „Hardware für den Nachbau“

Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 0 Gäste