I have a short websites written in PHP that should execute a Python file when I submit a dedicated form. However, when I used the PHP page, the script is never executed (i.e. the output is empty and the script python did not what it is supose to do.
All the files are located in /var/www/html, the owner of the Webserver is www-data, I have change the rights of check_directory with :
sudo chown www-data:www-data check_directory.py
sudo chmod +x check_directory.py
Inside about.php, I have :
$output = exec('./check_directory.py');
echo $output
ls -la gives :
-rwxrwxrwx 1 www-data www-data 1334 nov. 10 11:46 check_directory.py
-rw-r--r-- 1 root root 13625 nov. 10 12:12 about.php
I already know it is necessary to give PHP the rights to execute the script according to www-data, and I thought to do it correctly. But, I changed from exec to shell_exec, I directly used python check_directory instead of create an executable ...
I cannot say if there is a problem of rights now, or functions inside Python file since in console, the code works properly.
I really appreciate to get some help :) Thanky you all
-A