Magento 1.9.1.1 – How to Fix Cron.php Error

ce-1.9.1.1cronerrormagento-1.9system.log

This may or may not have anything to do with my question HERE. While investigating the issue, I checked the system.log file and found these two entries listed over and over:

2015-05-27T16:00:47+00:00 ERR (3): Warning: shell_exec() [function.shell-exec]: Unable to execute
'/bin/sh /home/lbingman/public_html/cron.sh cron.php -mdefault 1 >
/dev/null 2>&1 &' in /home/lbingman/public_html/cron.php
on line 64

2015-05-27T16:00:47+00:00 ERR (3): Warning: shell_exec() [function.shell-exec]: Unable to execute
'/bin/sh /home/lbingman/public_html/cron.sh cron.php -malways 1 >
/dev/null 2>&1 &' in /home/lbingman/public_html/cron.php
on line 65

So, of course I take a look at cron.php and find this…

Line 64: shell_exec("/bin/sh $baseDir/cron.sh $fileName -mdefault 1 > /dev/null 2>&1 &");

Line 65: shell_exec("/bin/sh $baseDir/cron.sh $fileName -malways 1 > /dev/null 2>&1 &");

Is there some bad code that I am not aware of? Or is there something else going on that is causing these errors that isn't code related? I am having issues with cron not being executed. Then when I manually execute cron.php via my web browser, it runs and runs without stopping.

Best Answer

First of all, check PHP safe_mode is Off & shell_exec() is not included in disable_functions in php.ini, then...

Be sure that cron.php file has permissions to be executable

Be sure too, that the cron command is properly written, for instance

15/* * * * * /usr/bin/php -q <path_to_magento>/cron.php
Related Topic