简体   繁体   中英

Call a python script from a PHP script

I have written a python script (mail.py) to send email in python, and I have written another file to submit action. I need that the file mail.py should run in background. when I am writing the follwing code

$result=shell_exec('python mail.py&');
                echo $result;

then there is no response but when i am running the file python mail.py & then it is running successfully

您必须像这样设置python解释器的完整路径:

 shell_exec('/usr/bin/python mail.py &');

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM