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 byec2-user
.
My specs:
- Server: Amazon Linux AMI
- Apache/2.2.26 (Unix)
- PHP 5.3.28
- Python 2.6.9