HummingbirdUK main logo

Coding solutions to business problems

About us

We use code to create solutions to business challenges, bottle-necks and headaches.

If you think your business has a problem that can be solved through code, we are happy to chat things through without any obligation.

Get in touch

Cron jobs stop working in Magento 1.8

Home / Blog / Cron jobs stop working in Magento 1.8

Written by Giles Bennett

A number of clients have experienced the same issue following upgrades to 1.8 from existing Magento installations - their Magento cron jobs, which historically had been operating just fine, stop working for no apparent reason.

Magento has two cron scrips, one a bash script (cron.sh) and the other a PHP script (cron.php) - this issue was only happening with those clients who were running their cron jobs by calling the PHP script on a regular basis.

It turned out to be down to a code change in cron.php in Magento 1.8, which would try and use the bash script, in preference to the PHP script, if a shell was available, but in evaluating this was using a function which could give a false positive - making it think that a shell was available when it wasn't. It would then try to use cron.sh, but be unable to do so.

The solution is to tell the script that shell is disabled - in cron.php (which you'll find in the web root of your installation) find the line :

$isShellDisabled = (stripos(PHP_OS, 'win') === false) ? $isShellDisabled : true;

and immediately after it, add this :

$isShellDisabled = true;

This forces it to continue using the PHP script, rather than the shell script, irrespective of whether it thinks that it can use the shell or not. It's a bit of a dirty hack, but it works!

Author : Giles Bennett

About the author

Giles Bennett built his first website in 1996, and is old enough to miss Netscape Navigator. Initially a lawyer, he jumped ship to IT in 2008, and after 5 years as a freelancer, he founded HummingbirdUK in 2013. He can be reached by email at giles@hummingbirduk.com.