Cron error "syntax error, unexpected '.', expecting '" using 1 & 1 hosting

Cron error "syntax error, unexpected '.', expecting '" using 1 & 1 hosting

by Kevin Lundy -
Number of replies: 6

I wanted to post this for those of you having issues with 1&1 hosting.  Not many 1&1 forum posts here. 

I am using 1&1 hosting "Click and Build" Application.  Moodle 3.2.1 (Build: 20170109)  

I was getting an error trying to run CRON by using http://yourinfo.com/admin/cron.php  The error was "!!! Exception - syntax error, unexpected '.', expecting ')' !!!"

Issue fixed by editing the clilib.php file located @ "http://yourinfo.com/lib/clilib.php"  

The issue was an extra dot "."  in the follwing code.   Look at die(" ".$text

Before Changes

cli_writeln($text.PHP_EOL, STDERR);

    die(." ".$text);

After Changes

cli_writeln($text.PHP_EOL, STDERR);

    die(" ".$text);

Just open up the file and search for "die" it will bring you right to it.  

Hope this helps someone else.  

Average of ratings: Useful (1)
In reply to Kevin Lundy

Re: Cron error "syntax error, unexpected '.', expecting '" using 1 & 1 hosting

by Damyon Wiese -

The standard Moodle version of that file has nothing like that line of code. This would make be extremely wary of trusting Moodle package from this host. Who knows what else they have changed?



Average of ratings: Useful (3)
In reply to Damyon Wiese

Re: Cron error "syntax error, unexpected '.', expecting '" using 1 & 1 hosting

by Marcus Green -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

To add to Damyons comment, core Moodle code is constantly checked against automatic tests and there is large amounts of Quality Assurance testing by real human beings. When you run something from another source you do not know what testing has or has not been done.

One of the reasons I am commenting on this is that the automatic (behat) tests I wrote for one of my own plugins (the wordselect question type) just revealed a bug in some new code I was writing, which illustrates how useful this type of testing can be.

Average of ratings: Useful (1)
In reply to Damyon Wiese

Re: Cron error "syntax error, unexpected '.', expecting '" using 1 & 1 hosting

by Kevin Lundy -

I have been using this host and Moodle for over 5 years now with very little issues.  They do change some code to work on their servers but it is very stable and secure.  

In reply to Kevin Lundy

Re: Cron error "syntax error, unexpected '.', expecting '" using 1 & 1 hosting

by Bret Miller -
Picture of Particularly helpful Moodlers

From cron, isn't the best method of running it by using the CLI version:

* * * * * php yourinfo.com/admin/cli/cron.php



Average of ratings: Useful (1)
In reply to Bret Miller

Re: Cron error "syntax error, unexpected '.', expecting '" using 1 & 1 hosting

by Dave Emsley -

Yes, if you have that type of access.


Interestingly enough I have the same error (same hosts) but my lib/clilib.php doesn't have that code.


Dave

In reply to Kevin Lundy

Re: Cron error "syntax error, unexpected '.', expecting '" using 1 & 1 hosting

by Alfonso Portones -


Thank you very much. I had the same error and I solved it by editing the clilib.php file