使用nginx后,FastCGI错误

时间:2013-06-19 18:07:30

标签: php yii nginx fastcgi

我刚开始为我的项目使用服务器,我在网络服务器上安装了nginx。 在我的开发环境中,我使用apache,因为在Windows中安装速度要快得多。我有一个基于Yii框架的PHP项目。

由于我将源代码克隆到此服务器,因此收到此消息,我找不到任何解决方案来解决它:

2013/06/19 17:54:33 [error] 21842#0: *1 FastCGI sent in stderr: "PHP Parse error:  syntax error, unexpected '[' in /path/to/file.php on line 23" while reading response header from upstream, client: 85.XXX.YYY.ZZZ, server: example.dk, request: "GET /product/list HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "example.dk"

该文件中的line 23是一个正常的数组初始化,没有什么额外的。

$models = [];

由于此错误,我的网站返回状态代码为500。

我的PHP配置未受影响。

我无法弄清楚是什么原因引起的。我该如何解决这个问题?

1 个答案:

答案 0 :(得分:2)

仅在php> = 5.4中支持将$models = [];替换为$models = array();短数组语法。

或者更新你的php版本。