Reputation: 1
On a Raspberry 5, I execute the following php code
$id = 0;
$message = exec("/home/pi/Python/hps_get_voltage_fraction_from_mcp3008.py ".$id." 2>&1");
return $message;
I get the following response:
sh: 1: /home/pi/Python/hps_get_voltage_fraction_from_mcp3008.py: Permission denied
The ownership/permissions are set as follows:
pi@raspberrypi:~/Python $ ls -l
total 4
-rwxrwxrwx 1 www-data www-data 372 Dec 2 18:18 hps_get_voltage_fraction_from_mcp3008.py
The whoami
return exec('whoami');
responds with:
www-data
I tried changing ownership of the script; all to no avail. I also tried executing through sudo
, but I get prompted for a password when I exec(sudo...)
.
Platform info:
pi@raspberrypi:~/Python $ cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
Upvotes: 0
Views: 29