cron help! (1and1 shared server)

I have been trying to get cron working the past couple of days, without luck. My first attempt was using:

The closest I got was having cron.php.1, cron.php.2, etc files created on the root domain(and not the sub-domain or sub domain’s sub folder psa where the system sits) contain “cron.php is CLI only.”. I only got that action when I used the above format.

SuiteCRM’s scheduler page at the bottom tells me to use:

          • cd /homepages/6/dxxxxxxx3/htdocs/intranet/psa; php -f cron.php > /dev/null 2>&1

I tried that and the scheduler still didn’t run.

I’ve folllowed a few different guides and tried a bunch of stuff. Pwd on SSH gives me the path:

/homepages/6/dxxxxxxx3/htdocs/intranet/psa

The 1and1 guide tells me to use the following format:

          • /usr/bin/php /kunden/homepages/6/dxxxxxxx3/htdocs/intranet/psa/cron.php

After that wasn’t working, I decided to call 1and1.

They said the issue was not specifying the php version. I did a phpinfo and my server is running 5.4, and the ini also points to usr/lib and not usr/bin so I also changed that:

          • /usr/lib/php5.4 /kunden /homepages/6/dxxxxxxx3/htdocs/intranet/psa/cron.php

Scheduler still isn’t running.

Any ideas what I’m doing wrong?

Is it possible there is something wrong with my cron.php script?

When I run it within SSH on the server manually, it says:

./cron.php: line 1: ?php: No such file or directory
./cron.php: line 2: syntax error near unexpected token 'sugarEntry'' ./cron.php: line 2: if(!defined(‘sugarEntry’))define(‘sugarEntry’, true);’

Is that to be expected?

I went through the below link, and was able to manually run the test script after creating by typing cronTest.php, but it didn’t auto-run once I added it with the specified info (pointing to php and ran pwd to get correct directory). So something is wrong.

https://help.1and1.com/hosting-c37630/scripts-and-programming-languages-c85099/cron-jobs-c37727/create-a-cron-job-a595882.html

Well now I realized when I manually tried to run cron.php, I didn’t specify php beforehand in SSH.

Now, I get the following error:

X-Powered-By: PHP/4.4.9
Content-type: text/html


Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /homepages/6/dxxxxxxx3/htdocs/intranet/psa/include/entryPoint.php on line 129

Any ideas?

Getting somewhere… I was able to get my cronTest.php to run via crontab finally using curl:

So the SSH uses 4.4.9 php by default, so I would need to specify the php version on the crontab. However, when I run manually as php5.4 cron.php, I get cron.php is CLI only.

Is that expected?

Any cron experts out there? It doesn’t make any sense to me that a different script at the same location works fine, yet the SuiteCRM script doesn’t run.

custom script runs fine:

SuiteCRM script doesn’t run:

WORKING!!! I read on the following link of someone who had the same issue:

http://forums.sugarcrm.com/f3/help-sugar-6-5-throwing-cron-php-cli-only-error-80983/

I had to comment out line 47-50
$sapi_type = php_sapi_name();
if (substr($sapi_type, 0, 3) != ‘cli’) {
sugar_die(“cron.php is CLI only.”);
}

Now it runs perfect.

1 Like