0

I am using the following method to get cron to work with wordpress. It has worked in the past but recently (around December of 2019) it stopped working. It hasn't become too big of a problem until recently.

/usr/local/cpanel/3rdparty/bin/php /home/public_html/wp-content/plugins/civicrm/civicrm/bin/cli.php -s SITE -u USERNAME -p PASSWORD -e Job -a execute

The error that i get from cPanel is:

PHP Parse error: syntax error, unexpected '?' in /home/public_html/wp-content/plugins/civicrm/civicrm/bin/cli.class.php on line 214

Can anyone help me figure out what to do.

2
  • Do you have any special characters in the username/password? Looks like and escape character problem (you could try surrounding the Username/Password in double quotes). – Parvez Saleh Dec 15 '20 at 11:04
  • I do not have any special characters but I attempted to use double quotes and it didn’t help. – Julien Flesher Dec 15 '20 at 17:38
1

That could be an old version of php. Assuming you are on current CiviCRM then try setting your php version to 7.3 See https://docs.civicrm.org/installation/en/latest/general/requirements/#php

5
  • My hosting provider only allows up to PHP version 7.2.26 – Julien Flesher Dec 15 '20 at 17:41
  • Check that /usr/local/cpanel/3rdparty/bin/php is actually 7.2 Sometimes there are different executable names for different versions - eg .../bin/php7.1 ../bin/php7.2 – Aidan Dec 16 '20 at 10:28
  • The Null Coalescing Operator has been available since PHP 7.0 php.net/manual/en/… – Christian Wach Dec 16 '20 at 13:19
  • I suspect Aidan is right and that your command line PHP is not 7+ – Christian Wach Dec 16 '20 at 13:20
  • I checked with my hosting provider. They had me update the file path to usr/local/bin/php72 – Julien Flesher Dec 17 '20 at 23:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.