问题
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