So I have been trying to turn on some lights using this code exec("python /var/www/html/scripts/lights/lampon.py");
. When I run it directly in the terminal it works, but when I try to run this through my page, it dosen't do anything. Even when I run the code above through php -a
it works... So I do not know what the problem is. If anyone has an answer to this it would be great. I've tried almost everything but nothing works. Thanks in advance.
Asked
Active
Viewed 63 times
1

user8450278
- 19
- 3
-
Have you looked at SELinux? If not in production, try setting it to permissive to see if that resolves the issue. It sounds like it could be an SELinux problem. – rg6 Sep 02 '17 at 02:24
-
1permission issues – mwweb Sep 02 '17 at 04:33
-
Another thing is that you might make the path to python absolute. – Brian Gottier Sep 02 '17 at 05:00
-
Possible duplicate of [Running a Python script from PHP](https://stackoverflow.com/questions/19735250/running-a-python-script-from-php) – localheinz Sep 02 '17 at 10:24