Asa2_Cron_Ratings produces parse error: syntax error, unexpected ‘{‘


The following error occurs when executing an ASA2 cronjob:

Parse error: syntax error, unexpected '{' in /****/blog/wp-content/plugins/amazon-simple-affiliate/lib/IfwAsa2/Wp/Plugin/Cli/Executables/script.php on line 18


This is probably because you are running the cronjob with an outdated PHP version which does not support the code in the cronjob script. You need at least PHP version 5, better version 7.

With some webhosters the standard command “php” executes an outdated version and there is a special command for each version, e.g. “php5” or “php7“. Which version the command “php” uses, you can see by executing “php -v“. If this results in a version less than 5.3, please ask your webhoster how you can run PHP scripts on the shell with a current version.

For example, if there is a “php56” command on your server that allows you to run PHP version 5.6 on the shell, you can tell the ASA2 cronjob that it should use this command with the “php” option, like this:

bash Asa2_Module_Repo_Cron_Refresh --limit=10 --php=php56