0

I have a PHP script that I run from cron. I never get emails.

maillog:

postfix/sendmail[2223187]: fatal: execv /usr/libexec/postfix/smtpd: Permission denied

Command-line:

* * * * * root /usr/bin/php /var/www/script.php

If I run this script from the command line or URL everything is fine. What is the difference between cron and other stuff?

mforsetti
  • 2,488
  • 2
  • 14
  • 20
VJS
  • 1
  • To answer your specific question: cron runs the jobs in an environment that may or (usually) may not match the environment of "other stuff". Different user, different environment variables set, etc. When you test your script from the command line, are you doing it as 'root'? – Brandon Xavier Mar 22 '21 at 06:05
  • Yes. I am running like root but tried from apache and other users (from command-line / URL everything fine, cronjob failing). From URL/command-line first step: postfix/smtpd[2222779]: connect from localhost[127.0.0.1] From cronjob: fatal: execv /usr/libexec/postfix/smtpd: Permission denied – VJS Mar 22 '21 at 06:14
  • This might be helpful: https://serverfault.com/questions/449651/why-is-my-crontab-not-working-and-how-can-i-troubleshoot-it – Brandon Xavier Mar 22 '21 at 06:21

0 Answers0