Laravel:PHP解析错误:语法错误,意外的“?"在第500行的/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php中 [英] Laravel: PHP Parse error: syntax error, unexpected '?' in /vendor/laravel/framework/src/Illuminate/Foundation/helpers.php on line 500
问题描述
自从我将php版本从5.6升级到7.2以来,我的php_errors.log上存在一个持久错误: PHP解析错误:语法错误,意外的?"在第500行的/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php中
Since i upgraded my php version from 5.6 to 7.2, i have a persistant error on my php_errors.log:
PHP Parse error: syntax error, unexpected '?' in /vendor/laravel/framework/src/Illuminate/Foundation/helpers.php on line 500
第500行:
返回$ factory-&of;($ arguments [0],$ arguments [1])-> times($ arguments [2] ?? null);
我在stackoverflow上搜索此文件,主要原因是服务器仍在使用php5.6,但我认为这不是原因.Platform是Laravel 5.7,显然一切正常.
I Search for this on stackoverflow, and the main cause is server still using php5.6, but i think it's not the reason. Platform is Laravel 5.7 and apparently is all working fine.
如果我从终端运行 php -v
,我得到了PHP 7.2:
If i run php -v
from the terminal i got PHP 7.2:
PHP 7.2.12-1 + ubuntu16.04.1 + deb.sury.org + 1(cli)(内置:2018年11月12日09:55:12)(NTS)版权所有(c)1997-2018 The PHP GroupZend Engine v3.2.0,版权所有(c)1998-2018,Zend Technologies with Zend OPcache v7.2.12-1 + ubuntu16.04.1 + deb.sury.org + 1,版权所有(c)1999-2018,Zend Technologies
关于stackoverflow的一些问题建议添加一个phpinfo来显示系统使用的php版本,并且实际上是正确的:
Some questions on stackoverflow suggest adding a phpinfo to show the php version used by the system, and actually is the correct:
即使我尝试禁用旧版本,服务器也说php5.6已被禁用:
Even if i tried to disable old version, server says that php5.6 is already disabled:
模块php5.6已禁用
在禁用php5.6并运行php 7.2的情况下,这可能是什么引起的?
With php5.6 disabled and php 7.2 up and running, what could be causing this ?
谢谢.
推荐答案
如@MonkeyZeus所建议的,通过重新引导服务器解决了问题.显然,在升级PHP和Laravel之后都没有加任何东西.
Problem solved with a server reboot, as suggested by @MonkeyZeus. Apparently something was not adding up after upgrade both PHP and Laravel.
这篇关于Laravel:PHP解析错误:语法错误,意外的“?"在第500行的/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!