php -f cron.php Schedule Tasks Not Running Due to Script Failure

Scheduled task appear to be not running (although on some rare occasions “Last Successful Run:” was updated.)

AOP Check Inbound Mailboxes has never run and is active.
Check Inbound Mailboxes has never run (but is inactive).

IMAP support in PHP is installed and running. phpinfo() reports IMAP c-Client Version 2007f with SSL and Kerberos Support enabled.

I have a crontab setup:

iMac:/some/dir user_name$ sudo crontab -l
Password:
*/5 * * * * cd /some/web/root/dir/service; php -f cron.php > /dev/null 2>&1

Meanwhile, I can just cd to the directly and run the cron.php script from the command line. The errors vary, but typically look like these:

iMac:dir_name user_name$ sudo php -f cron.php
PHP Notice:  Undefined index: module in /some/web/root/dir/service/modules/AOW_WorkFlow/AOW_WorkFlow.php on line 134
PHP Notice:  Undefined index: module in /some/web/root/dir/modules/AOW_WorkFlow/AOW_WorkFlow.php on line 134
[b]PHP Notice:  Undefined property: InboundEmail::$team_id in /some/web/root/dir/service/custom/modules/Schedulers/_AddJobsHere.php on line 61
PHP Fatal error:  Call to undefined function imap_expunge() in /some/web/root/dir/custom/modules/Schedulers/_AddJobsHere.php on line 207[/b]
PHP Notice:  Undefined index: module in /some/web/root/dir/service/modules/AOW_WorkFlow/AOW_WorkFlow.php on line 134
iMac:dir_name user_name$ sudo php -f cron.php
PHP Notice:  Undefined index: module in /some/web/root/dir/service/modules/AOW_WorkFlow/AOW_WorkFlow.php on line 134
PHP Notice:  Undefined index: module in /some/web/root/dir/modules/AOW_WorkFlow/AOW_WorkFlow.php on line 134
PHP Notice:  Undefined index: module in /some/web/root/dir/modules/AOW_WorkFlow/AOW_WorkFlow.php on line 134
PHP Notice:  Undefined index: module in /some/web/root/dir/modules/AOW_WorkFlow/AOW_WorkFlow.php on line 134
PHP Notice:  Undefined index: module in /some/web/root/dir/modules/AOW_WorkFlow/AOW_WorkFlow.php on line 134
PHP Notice:  Undefined index: module in /some/web/root/dir/modules/AOW_WorkFlow/AOW_WorkFlow.php on line 134
[b]PHP Fatal error:  Call to undefined function imap_search() in /some/web/root/dir/modules/InboundEmail/InboundEmail.php on line 4600[/b]
PHP Notice:  Undefined index: module in /some/web/root/dir/modules/AOW_WorkFlow/AOW_WorkFlow.php on line 134

Well, a good place to start is always to ensure your permissions are all set properly.

Also this stood out to me
PHP Fatal error: Call to undefined function imap_expunge()

maybe not all php modules are installed?

I’m not familiar with mac. just throwing some ideas out there.

Are you using a custom module with AOW?

This does look like this is the problem from what I can see here.

This would be what I would focus my attention on. Looks like there is something going on with the Imap functions as there is the imap_expunge and the imap_search both which can not be found by the looks of it.

might be worth looking into why these are not being found. a possible cause is it is installed but its not enabled.

Ian.

Hi Ian,

It is definitely enabled, since IMAP functions work: system send e-mail, user account mailboxes, triggered e-mails, etc. Also, the phpinfo(); function confirms it is enabled.

There is something about cron triggered IMAP that has a bug…

Could the cron be running off a different php.ini file ?

Ian

Have a look at this

http://stackoverflow.com/questions/2750580/how-to-find-the-php-ini-file-used-by-the-command-line

you can also use in the command line

php --ini

it will help you find out if it is using the same php.ini file or not.

Ian

1 Like

You totally nailed it. The non-IMAP Apple installed version of PHP is /usr/bin/php. The Brew copy with IMAP is /usr/local/bin/php. Of course, Apache was configured to use the replacement version, but not the command line.

iMac:~ user$ sudo crontab -l
*/5 * * * * cd /Library/WebServer/some/directory/name; /usr/local/bin/php -f cron.php > /dev/null 2>&1

Thank you

1 Like