Question
How to execute script pyhon with php?
I have a project PHP in my droplet LEMP 16.04 with script python, when I run in terminal is ok, but when I run in the browser don’t execute the script.
My PHP
$vehicleJSON = shell_exec('python vehiclepy.py ' . $plate);
I’ve already tried:
- change to $vehicleJSON = shell_exec(‘python vehiclepy.py ’ . $plate . ’ 2>&1’);
- change to $vehicleJSON = shell_exec('usr/bin/python /var/www/myapp/vehiclepy.py ’ . $plate);
- add in sudoers www-data NOPASSWD: /var/www/myapp but don’t execute.
Please help me kkkkk, thanks!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×