Laravel:第 384 行的 vendor/laravel/framework/src/Illuminate/Support/Arr.php 中的语法错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/56658142/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Laravel:syntax error in vendor/laravel/framework/src/Illuminate/Support/Arr.php on line 384
提问by johannchopin
I tried to make a new laravel project work on my debian vps but nothing go right. I init the project with the basic composer create-project laravel/laravel
, change the permissions to 755
so everything that is explained here.
我试图在我的 debian vps 上创建一个新的 laravel 项目,但没有任何进展。我用基本的初始化项目composer create-project laravel/laravel
,将权限更改755
为这里解释的所有内容。
But I always have an error 500
when I tried to access to my <pathToMyProject>/public
folder and when I read my php's logs is see this message :
但是error 500
当我尝试访问我的<pathToMyProject>/public
文件夹时总是有一个问题,当我阅读我的 php 日志时看到这条消息:
PHP Parse error: syntax error, unexpected '=' in /vendor/laravel/framework/src/Illuminate/Support/Arr.php on line 384
PHP 解析错误:语法错误,第 384 行 /vendor/laravel/framework/src/Illuminate/Support/Arr.php 中的意外“=”
What can be the problem ? I precise that my php version is >7.1
可能是什么问题?我确切地说我的 php 版本是>7.1
回答by Dinesh Bajgain
It is possible that the CLI version of PHP is 7.2 but apache is using an older version of PHP. Would be worth adding a phpinfo.php
in the root of your public folder containing
PHP 的 CLI 版本可能是 7.2,但 apache 使用的是旧版本的 PHP。值得phpinfo.php
在您的公用文件夹的根目录中添加一个包含
<?php
phpinfo();
the navigate to your http://www.yoursite.com/phpinfo.phpand double check the version.
导航到您的http://www.yoursite.com/phpinfo.php并仔细检查版本。
Ensure you remove the phpinfo.php
file once you have tested.
确保phpinfo.php
在测试后删除该文件。
回答by Gufran Hasan
I faced the same problems. I resolved it by running the following commands.
我遇到了同样的问题。我通过运行以下命令解决了它。
php -v
php -v
It displays the current running php version => 7.0
它显示当前运行的 php 版本 => 7.0
a2dismod php7.0
a2dismod php7.0
It will be disabled php7.0 version.
php7.0 版本将被禁用。
a2enmod php7.2
a2enmod php7.2
It will be enabled php7.2 version.
它将启用 php7.2 版本。
service apache2 restart
服务 apache2 重启
回答by Software Developer
Just Ensure you upgrade your php version on the server like from 7.0 to something like 7.3. if you are using the CPanel navigate to Web Toolsthen PHP Configurationand change the php version
只需确保将服务器上的 php 版本从 7.0 升级到 7.3。如果您使用 CPanel 导航到Web Tools然后PHP 配置并更改 php 版本