3

I cannot at all execute a python script via php exec. This is my code

<?php
$output = shell_exec("python /var/www/html/socket/power_on.py");

$output = shell_exec("sudo python /var/www/html/socket/power_on.py");

$output = shell_exec("/usr/bin/python /var/www/html/socket/power_on.py");
echo $output;
?>

I've tried all of the above yet no luck the only command that seems to work that I've also tried is 'ls' How to I give the user www-data access to sudo, as that may work. Since I've tried chmod 777 on the directory and file still no luck

Casper Round
  • 91
  • 1
  • 1
  • 4

0 Answers0