Search code examples
phpapacheraspberry-pishell-exec

shell_exec not running in websever


I have an apache web sever with php file /var/www/html/test.php, and servo.py in the same directory. When I go to localhost/test.php it doesn't work. Yet when I run test.php in an IDE it works fine. Any help?

test.php:

<?php
    shell_exec("python servo.py");
?>

Solution

  • It was a permissions error! I had to add www-data to the gpio group.

    sudo adduser www-data gpio