dpd3447 2014-04-29 17:23
浏览 53

从PHP运行时,Python不会发送电子邮件

I'm working on a small site that runs via PHP a Python file.

The python file takes a few minutes to run and when finished send an email informing you that the process has finished running.

If I run the script manually from Terminal the email was sent. But when I try to run it from PHP using system() function does not send the email.

I tested the issue by dumping and running the same line that system() would run via PHP, so no typos when running the test.

The python file tweets content from a CSV file with a random interval between a range of seconds and once all the tweets are sent it notifies via email to the user who run the script.

tweet.py {csv_file} {interval_min} {interval_max} {email_to_notify_when_finished}

python tweet.py test.csv 10 20 some@email.com

Other notes:

  • The python file has permission to be executed (777).
  • Apache is using ec2-user user, the same user that I used for manually testing this issue.
  • ps -aux shows me that the scripts are correctly run by ec2-user.

My specs:

  • Server: Amazon Linux AMI
  • Apache/2.2.26 (Unix)
  • PHP 5.3.28
  • Python 2.6.9
  • 写回答

1条回答 默认 最新

  • dongmei1988 2014-04-29 17:25
    关注

    Can you try to narrow down what the python script is doing? You can try something as simple as print statements or write to file to confirm how much of your code is being run by the program when it is run by PhP.

    评论

报告相同问题?

悬赏问题

  • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 MATLAB中streamslice问题
  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端
  • ¥15 基于PLC的三轴机械手程序