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). Dec 15, 2020 at 11:04
  • I do not have any special characters but I attempted to use double quotes and it didn’t help. Dec 15, 2020 at 17:38

1 Answer 1

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 Dec 15, 2020 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, 2020 at 10:28
  • The Null Coalescing Operator has been available since PHP 7.0 php.net/manual/en/… Dec 16, 2020 at 13:19
  • I suspect Aidan is right and that your command line PHP is not 7+ Dec 16, 2020 at 13:20
  • I checked with my hosting provider. They had me update the file path to usr/local/bin/php72 Dec 17, 2020 at 23:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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