0

I received the error when I try to run on the live site. ( I was able to upgrade to 2.2.9 for the test site, which was cloned from the live site).

after i did

composer require magento/product-community-edition 2.2.9 --no-update

composer update

for updating from magento 2.2.6. to 2.2.9 (which went fine), then ..

php bin/magento setup:upgrade

error message is .........

Parse error: syntax error, unexpected '?', expecting variable (T_VARIABLE) in /home/username/m2stagenew/generated/code/Magento/Framework/App/Config/Value/Interceptor.php on line ....

magento version is 2.2.7 - > 2.2.9

php -v ---> shown php version is 7.0.033

but in siteground cpanel, shown "PHP 7.1.30" is selected"

I have searched and found a few answers, but all applied to 2.3.x version, which required high php versions (7.1 or 7.2). so i also tried the following command

php72 bin/magento setup:upgrade

which came out with another error..

1

CLI version of PHP is different. Ran into this on Inmotion hosting.

First run in CLI whereis php which will show all the PHP locations installed

Then in root folder of your server there is a file called .bashrc

Edit it to contain line like

alias php=/opt/imh/imh-php72/root/usr/bin/php

with location of php version you want to use in CLI Reconnect to CLI and it should use PHP version you specified for php calls

  • what version did you try to update from/to? i'm trying to update from 2.2.7 to 2.2.9. i could ran it as "php71 bin/magento setup:upgrade" but still giving me error.. i thought magento 2.2 does work with both php 7.0 and 7.1 – Kris Wen Jul 10 at 23:08
  • when i run "whereis php", i got two locations "php: /usr/bin/php /usr/local/bin/php", how do i edit my .bashrc file? thanks! – Kris Wen Jul 10 at 23:17
  • I ran into this issue when installing a test magento 2.2.9 on my shared hosting ( inmotion has php default to 7.2 but in cli it is 5.6 by default) when i ran whereis php it showed like 10 different locations ranging from 5.6 to 7.3 so you might have to talk to your host about location of php version you need and then add it to cli through .bashrc file – Deggial Jul 12 at 18:26
  • you also might try to set php alias in bashrc file then run php -v to see which version each is – Deggial Jul 12 at 18:27
  • and to edit the bashrc file just open & edit it in file manager in cpanel – Deggial Jul 12 at 21:57

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.