Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

mikail10000000's avatar

php 7.1.14 does not work with laravel

Hi, I just got started with laragon, and it has php 7.1.14 and latest version of laravel 5.6 which is according to docs requires PHP >= 7.1.3 , but the laravel fails , when I run phpunit it thorws this error:

Parse error: syntax error, unexpected ':' in C:\laragon\www\forum\vendor\laravel\framework\src\Illuminate\Foundation\helpers.php on line 233

What version of php should I use with laravel 5.6 ?

0 likes
10 replies
rin4ik's avatar

Having php 7.1 installed is not the same as running php 7.1. in yourpublic/index.php file write phpinfo(); and check in browser which version of php laravel uses . remove php 5.6 apt-get purge php5.6-common if you like and run these commands

sudo a2dismod php5.6
sudo a2enmod php7.1
sudo service apache2 restart
1 like
Snapey's avatar

php from the command line can be a different version to that running in the web server

1 like
rin4ik's avatar

The error on that line is being thrown because a null coalescing operator is being used, which was added in php7 and is incompatible with php5. like I said earlier remove all previous versions of php if you won't use them. and enable php 7.1

1 like
Cronix's avatar
Cronix
Best Answer
Level 67
Route::get('/phpinfo', function() {
    phpinfo();
});

Hit that route. Find the php version number. (delete when done)

Then from cli, php -v. They should both match, or be greater than the minimum requirement (>= 7.1.3).

1 like
rin4ik's avatar

sudo apt-get purge php5.6-common

sudo a2enmod php7.2
sudo service apache2 restart
1 like
mikail10000000's avatar

@rin4ik , thank you, I use laragon , I have already installed php 7 there but it probably picks on my globally installed php from xammp

1 like

Please or to participate in this conversation.