解析错误:语法错误,意外'[',期待')'

时间:2016-01-09 04:54:49

标签: php magento syntax

Iam尝试安装magento并将所有文件上传到我的服务器。现在,当我到达root / setup时,我得到了这个

解析错误:第29行语法错误,意外'[',期待')'setup / index.php

这是php文件

<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/

if (PHP_SAPI == 'cli') {
echo "You cannot run this from the command line." . PHP_EOL .
    "Run \"php bin/magento\" instead." . PHP_EOL;
exit(1);
}
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);
}

// For Setup Wizard we are using our customized error handler
$handler = new \Magento\Framework\App\ErrorHandler();
set_error_handler([$handler, 'handler']);

\Zend\Mvc\Application::init(require __DIR__ . '/config/application.config.php')->run();

1 个答案:

答案 0 :(得分:2)

第29行是:

set_error_handler([$handler, 'handler']);

此代码需要PHP&gt; = 5.4,并且您使用的是5.3或更早版本。您需要升级您的PHP版本,或使用不需要PHP 5.4的旧版Magento。

Magento 1.x是documented to require PHP 5.4 or newer2.x requires 5.5 or newer

相关问题