Laravel:syntax error in vendor/laravel/framework/src/Illuminate/Support/Arr.php on line 384

六月ゝ 毕业季﹏ 提交于 2020-02-04 03:44:04

问题


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.

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 :

 PHP Parse error:  syntax error, unexpected '=' in <pathToMyProject>/vendor/laravel/framework/src/Illuminate/Support/Arr.php  on line 384

What can be the problem ? I precise that my php version is >7.1


回答1:


I faced the same problems. I resolved it by running the following commands.

php -v

It displays the current running php version => 7.0

a2dismod php7.0

It will be disabled php7.0 version.

a2enmod php7.2

It will be enabled php7.2 version.

service apache2 restart




回答2:


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 

phpinfo();

the navigate to your http://www.yoursite.com/phpinfo.php and double check the version.

Ensure you remove the phpinfo.php file once you have tested.




回答3:


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 Tools then PHP Configuration and change the php version



来源:https://stackoverflow.com/questions/56658142/laravelsyntax-error-in-vendor-laravel-framework-src-illuminate-support-arr-php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!