分析错误:语法错误,意外';[';,应为';)';


Parse error: syntax error, unexpected '[', expecting ')'

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

分析错误:语法错误,第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();

第29行为:

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

这段代码需要PHP>=5.4,而您使用的是5.3或更高版本。您需要升级您的PHP版本,或者使用不需要PHP 5.4的旧版Magento。

Magento1.x的文档要求PHP 5.4或更新版本。2.x需要5.5或更新版本。

相关文章: