production.ERROR: Parse error: syntax error, unexpected '?', expecting variable (T_VARIABLE)

production.ERROR: Parse error: syntax error, unexpected '?', expecting variable (T_VARIABLE)

在我的本地构建中,一切正常。我最近使用 Digital Ocean nginx 进行了部署。当我尝试上传图片时,我的日志文件中出现以下错误。

production.ERROR: Parse error: syntax error, unexpected '?', expecting variable (T_VARIABLE)

我的php版本是7.1.18,我的Laravel框架是5.5.40。

我已经阅读了几篇关于此错误的帖子,但不确定如何修复此错误。我的 php 版本似乎是正确的,不知道在哪里升级,是否需要升级。

当我到达 phpinfo 时,我得到以下

关于如何将服务器升级到 7.1 的任何想法?

检查 nginx 使用的 PHP 的版本。这可能与您的命令行中显示的不同。

执行以下操作,创建一个简单的 PHP 文件并将其放入您的 public 文件夹中:

hello.php

phpinfo()

然后在浏览器中点击 hello.php

更新:

如果版本不匹配,请检查您的 /etc/nginx/sites-available/default 文件。那里一定有东西..比如 fastcgi_pass.

中声明的 PHP 版本