Reputation: 682
I have installed Laravel 5.5 and I'm getting the same error, documentation says this:
I ran:
$ php artisan --version`
$ Laravel Framework 5.5.42
and I'm getting this error:
Symfony \ Component \ Debug \ Exception \ FatalThrowableError (E_PARSE)
Parse error: syntax error, unexpected '?', expecting variable (T_VARIABLE)
Is the documentation wrong? I'm using: https://laravel.com/docs/5.5/installation#installing-laravel My server can only use PHP 7.0. Not 7.1. Is there no way to run Laravel on 7 anymore?
I'm installing via composer.
Is there a way to download a compatible version with 7.0?
Upvotes: 2
Views: 13634
Reputation: 682
It was an issue with the Symfony Translation stack, i had to disable for the moment, also i have downgraded the carbon package to make it work, not sure why. It has some php7.1 code.
Upvotes: 0
Reputation: 15457
The issue could be that the command line version of PHP differs to the Apache version of PHP. Run php --version
and verify that you're using PHP 7.0.0 or greater.
Laravel 5.5.* has no issues running on PHP 7.0.*. I currently have a project running Laravel 5.5.43 on PHP 7.0.15 and this issue does not occur.
If the command line version of PHP is not up to date or if you have access to multiple versions of PHP, you should contact your hosting provider for help. You may also be able to run a command similar to the following to see if you can access a different version of PHP:
locate bin/php
The above may give you an idea of the installation location. For example, I see three different versions of PHP installed, but the default version (/usr/bin/php
) is 7.0.15:
/opt/cpanel/ea-php56/root/usr/bin/php
/opt/cpanel/ea-php70/root/usr/bin/php
/opt/cpanel/ea-php71/root/usr/bin/php
/usr/bin/php
Upvotes: 0
Reputation: 454
If you have PHP 5.5 (actually 5.5.9 or greater) you should use Laravel 5.2.
If you have PHP 7.0 you can use Laravel 5.5.
The error you mentioned is because you are using PHP 5.5 which does not support PHP 7 Null coalescing operator (??) and it is being used somewhere in Laravel code.
As you said your server supports PHP 7.0, you might have more than one PHP versions installed on your system. Check PHP version running php --version
.
Upvotes: 2