AnsweredAssumed Answered

Setting up cron.php as cron job in cpanel (uses jailshell shell)

Question asked by Plaster Pricer on May 5, 2015
After I installed sugarCRM Version 6.5.20 (Build 1001) on my cpanel shared LAMP server (php version 5.4.39, cPanel Version11.48.4 (build 2)), I entered the recommended cron job line:
cd /home/plasterp/public_html/sell; php -f cron.php > /dev/null 2>&1  
and set it to run every minute.

The way cron works on cpanel is that any output is sent as an email to an email address you select.

This cron job gave me the following output from the cron job:
/usr/local/cpanel/bin/jailshell: 1 : ambiguous redirect

I have removed the " > dev/null 2>&1" redirect from them end of the cron job to overcome this.

This gave me dozens of the strict standard messages I dealt with during the main install of SugarCRM such as:
<b>Strict Standards</b>:  Declaration of SugarEmailAddress::save() should be compatible with SugarBean::save($check_notify = false) in ...
So I entered:

error_reporting(E_ALL &  ~E_STRICT);

at the top of the cron.php file
I also had to change the CLI check to:
$sapi_type = php_sapi_name();
//if (substr($sapi_type, 0, 3) != 'cli') { <=== this did not work as my environment has php_sapi_name() returning "cgi-fcgi" so I changed it to:
if ($sapi_type!="cgi-fcgi") {

I am also worried because on other cron jobs I need to use the -q flag (quiet flag) to stop output being generated every time it runs.

However I am now concerned that I am not correctly redirecting errors from the cron.php task. Can anyone advise what a correct redirect would be for the cron.php task in a cpanel environment?

Outcomes