Hello,
I'm running magento 2.1.3 on php 7.0.15, when I run the command
php bin/magento indexer:reindex
I've got the error message :
PHP Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /vendor/magento/framework/App/Bootstrap.php on line 411
I search how to fix it on the forum but didn't find it... so how can I fix it ?
Thanks for your reply !
Are you sure that your PHP version in CLI is 7.0.x too? Type in command line:
php -v
And let me know what version it is.
Hello,
Version is php 5.4 ...
PHP 5.4.45-0+deb7u5 (cli) (built: Aug 30 2016 20:15:34) Copyright (c) 1997-2014 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
but phpinfo.php tell me it's php 7.0, I will contact my host.
Thanks for your reply
My host confirm me I'm running php 7.0.15 , so there shouldn't be any issue with php bin/magento indexer:reindex ?, isn't it ?
It is a problem. Everything you're hitting via browser (and which have to go through apache/nginx/php stack), it will be executed via your PHP 7.x.
But it seems like in your command line (CLI), PHP 5.4.x is configured, and that the issue. Everything you execute through command line will go through PHP 5.4.x, no matter what PHP you have configured on web server.
The only thing you can do (if your hosting provider doesn't want to fix it), is to try to find direct path to php7.0 binary, and execute it like:
/usr/bin/php7.0 bin/magento ...