Looking at cron.php
, the objective of that variable is to determine if something can be executed with sh
.
} else if (!$isShellDisabled) {
$fileName = basename(__FILE__);
$baseDir = dirname(__FILE__);
shell_exec("/bin/sh $baseDir/cron.sh $fileName -mdefault 1 > /dev/null 2>&1 &");
shell_exec("/bin/sh $baseDir/cron.sh $fileName -malways 1 > /dev/null 2>&1 &");
exit;
}
As you can see this elseif statement has an exit statement. Your script is therefore determining that you are not running windows and that shell_exec isn't disabled, thus you are hitting the exit statement. By forcing the variable to be true you are forcing the script to skip this part of the script.
This raises the question of why the above code isn't functioning as expected when it's not skipped. If I had to guess I would say that it's because of one of the following (in order of likeliness):
- The user triggering cron.php doesn't have +x permissions on cron.sh.
- The user triggering cron.php doesn't have
sh
in it's PATH.
- The OS that it's running on doesn't have support for something in the command.
- The php shell_exec function is disabled in some way other than the ini variable
disable_functions
(I don't know if this is possible or not).
You could debug this by finding the command that's actually ran by echo'ing out some debug info:
} else if (!$isShellDisabled) {
$fileName = basename(__FILE__);
$baseDir = dirname(__FILE__);
$cmd = "/bin/sh $baseDir/cron.sh $fileName -mdefault 1 > /dev/null 2>&1 &";
echo $cmd . PHP_EOL;
shell_exec($cmd);
$cmd = "/bin/sh $baseDir/cron.sh $fileName -malways 1 > /dev/null 2>&1 &";
echo $cmd . PHP_EOL;
shell_exec($cmd);
exit;
}
This will confirm the paths are correct and as expected. Then running the resulting commands to see what happens (you'll get better debug info by removing > /dev/null 2>&1 &
from the end).