Hi, I have this code on the Raspberry pi zero w:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<link rel="stylesheet" href="">
</head>
<body>
<?php
/**
* Ejecutando el encendido
*
* Se ejecuta el encendidom apagado y encendido programado.
*/
if (isset($_POST["1sec"]))
{
exec("/usr/bin/python /var/www/html/relay.py");
$que_hay = "Hola que hay, si se envió, pero ejecuta?";
echo $que_hay;
function success() {
$mystring = exec('/usr/bin/python /var/www/html/relay.py', $output);
var_dump($output);
}
success();
}
?>
<h1>Encender la puerta</h1>
<p>A conntinuación tenermos estas opciones para prender y apagar el Relé.</p>
<form action="index.php" method="post" accept-charset="utf-8">
<button name="1sec">Prender 1 segundo</button>
<button type="submit" value="">Encender</button>
<button type="submit" value="">Apagar</button>
</form>
<a href="execute.php">test</a>
<a href="test2.php">test2</a>
</body>
</html>
and I have my relay.py file
#!/usr/bin/python
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setup(26, GPIO.OUT)
GPIO.setwarnings(False)
GPIO.output(26, GPIO.LOW)
GPIO.output(26, GPIO.HIGH)
time.sleep(1)
GPIO.cleanup()
Which works in terminal with $python relay.py
I can not find the problem when executing with php said, I have already tried with relative discretions, shell_exec (), exec (), and the file php.ini does not have that function in deactivated
disable_functions = pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
I do not know what else to do ...