I'm trying to run a python file from a PHP script. The intended thing to happen is that when one browses to the */webhookMac.php on my site, the script name MacLabLogin.py will run. For some reason though, nothing happens. I checked the logs on my Apache2 server but I see no related logs (all the logs are from months ago).
Here is my PHP code
<?php
$command = escapeshellcmd("python3 /location/of/file/from/root/MacLabLogin.py");
$output = shell_exec($command);
echo $output;
?>
PHP works on my webserver and I know that PHP file is accessible and runs but for some reason, the part of running the .py file doesn't run the file. The python script also works when I run it manually.
PS: The "echos" don't return anything. The webpage is blank. I am on an Amazon Linux EC2 Instance.
Turned out the issue was that the selenium module could not be found. I added the selenium module files in the same file of the script and it was able to run smoothly.
pip3 install selenium -t /path/to/root/of/.py/script/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.