PHP can't find the python on my computer. When I tried to access python through php using the code below, it returned nothing.
The server is built on xampp
The php code:
<?php
$output=shell_exec('/usr/bin/python3 -V');
echo $output;
?>
What might be wrong?
- I have tried
python3 -V
on the terminal, and it displayed the version of python installed. - I saw that the reason might cause this problem is that the folder holding python does not have permission, so I
sudo chmod 777
all the folders on the path, but it doesn't change anything - using
sudo -u www-data /usr/bin/python3 -V
shows that the user is not allowed to access python.