cancel
Showing results for 
Search instead for 
Did you mean: 

Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable

Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable

Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable

Bom dia amigos(as) estou com o seguinte erro e não estou conseguiindo resolver...

peço ajuda....

erro

parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /var/www/shoppingdj/magento/index.php on line 38

<?php
/**
* Application entry point
*
* Example - run a particular store or website:
* --------------------------------------------
* require __DIR__ . '/app/bootstrap.php';
* $params = $_SERVER;
* $params[\Magento\Store\Model\StoreManager:ARAM_RUN_CODE] = 'website2';
* $params[\Magento\Store\Model\StoreManager:ARAM_RUN_TYPE] = 'website';
* $bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $params);
* \/** @var \Magento\Framework\App\Http $app *\/
* $app = $bootstrap->createApplication(\Magento\Framework\App\Http::class);
* $bootstrap->run($app);
* --------------------------------------------
*
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

try {
require __DIR__ . '/app/bootstrap.php';
} catch (\Exception $e) {
echo <<<HTML
<div style="font:12px/1.35em arial, helvetica, sans-serif;">
<div style="margin:0 0 25px 0; border-bottom:1px solid #ccc;">
<h3 style="margin:0;font-size:1.7em;font-weight:normal;text-transform:none;text-align:left;color:#2f2f2f;">
Autoload error</h3>
</div>
<p>{$e->getMessage()}</p>
</div>
HTML;
exit(1);
}

$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
/** @var \Magento\Framework\App\Http $app */
$app = $bootstrap->createApplication(\Magento\Framework\App\Http::class);
$bootstrap->run($app);

2 REPLIES 2

Re: Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or vari

Hello @fabio_dutra dua 

This is coming because of the miss match php version. 

 

You can check to run command like php -v and check the version of the php and when you try to run the command like composer update than it's uses different version of the php that's why you are getting this error.

 

Suggestion : you need to use full path of the php like /usr/bin/php71 -dmemory_limit=1g composer update 

 

If answer is useful??? please Accept as Solution & give Kudos

 

Thank you

Anant P 

Thank you
Anant Prajapati
Magento Certified Developer

Re: Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or vari

Oi Anant, obrigado pela resposta ...no fim vou ter que começar tudo de novo a configuração .... perdi os dados..

mais te agradesço  pela informação .. vou reinstalar tudo de novo ... posso te chamar se caso eu nao consiga?