3

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 /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

3
  • Woaw i'm so sorry for this mistake but my php version is >7.1. I updated my post Commented Jun 18, 2019 at 23:25
  • Are you sure your server is running php >7.1, not that you just have php >7.1 on your pc? Commented Jun 18, 2019 at 23:51
  • 1
    ok, Laravel 5.8 requires PHP >= 7.1.3 and some more server requirements. you can check that you have all the required extensions installed and activated by putting a phpinfo.php file in your public folder and opening in your browser your-domain/phpinfo.php. you can also run php -v via ssh, to make sure that the version is correct Commented Jun 19, 2019 at 0:02

5 Answers 5

7

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.

Sign up to request clarification or add additional context in comments.

Comments

6

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

Comments

0

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

Comments

0

I encountered this error using laravel in cpanel.

  1. Go to composer.json
  2. Check PHP version
  3. Go to the Cpanel dashboard
  4. Software > Select PHP version
  5. change PHP version to $php_version
  6. save and retry

Comments

0

My problem was that I have only installed php 7.0.

If it is your problem too. Do bellow step for installing 7.2:

sudo add-apt-repository ppa:ondrej/php

sudo apt-get update

sudo apt-get install php7.2

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.