douzouchang7448 2012-08-23 12:06
浏览 41
已采纳

从PHP脚本调用python脚本

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

  • 写回答

1条回答 默认 最新

  • dongzhang0243 2012-08-23 12:21
    关注

    You must set full path to python's interpreter like:

     shell_exec('/usr/bin/python mail.py &');
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

    报告相同问题?

    悬赏问题

    • ¥30 android百度地图SDK海量点显示标题
    • ¥15 windows导入environment.yml运行conda env create -f environment_win.yml命令报错
    • ¥15 这段代码可以正常运行,打包后无法执行,在执行for内容之前一直不断弹窗,请修改调整
    • ¥15 C语言判断有向图是否存在环路
    • ¥15 请问4.11到4.18以及4.27和4.29公式的具体推导过程是怎样的呢
    • ¥20 将resnet50中的卷积替换微ODConv动态卷积
    • ¥15 通过文本框输入商品信息点击按钮将商品信息列举出来点击加入购物车商品信息添加到表单中
    • ¥100 这是什么压缩算法?如何解压?
    • ¥20 upload上传实验报错500,如何解决?(操作系统-windows)
    • ¥15 谁知道 ShaderGraph 那个节点可以接入 Particle System -> Custom Data