Skip to content
Advertisement

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");
?>

Advertisement

Answer

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

sudo adduser www-data gpio
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement