sudo apt-get update && sudo apt-get upgrade
sudo apt-get install python-dev
sudo apt-get install python-rpi.gpio
sudo apt-get install apache2 php5 libapache2-mod-php5
sudo service apache2 restart
sudo nano /etc/sudoers
add to bottom of file: www-data ALL=(root) NOPASSWD:ALL
<html>
<head>
<meta charset="UTF-8" />
</head>
<?php
if (isset($_POST['ON']))
{
exec("sudo python /home/pi/script5.py");
}
if (isset($_POST['OFF']))
{
exec("sudo python /home/pi/script5a.py");
}
?>
<form method="post">
<button name="ON">turn On</button>
<button name="OFF">turn Off</button><br>
</form>
</html>
Холбоотой бичлэг :