Framework: PHP Parse error

Created on 18 Oct 2018  Â·  8Comments  Â·  Source: laravel/framework

  • Laravel Version: 5.7.9
  • PHP Version: 7.0.3
  • Database Driver & Version: 10.1.23-MariaDB-9+deb9u1

Description:

I got this error:
PHP Parse error: syntax error, unexpected '=' in /var/www/heimdall/vendor/laravel/framework/src/Illuminate/Support/Arr.php on line 388

Steps To Reproduce:

  • Installing apache2, php, mysql-server, php-mysql
  • Cloning Heimdall repository
  • Set Apache DocumentRoot to Heimdall public/ folder

Most helpful comment

@silas229 Can you please post your solution here?

All 8 comments

Laravel 5.7 requires PHP 7.1+.

oh okay, but how can I get PHP 7.1 via Raspbian apt-get?

that's a question for another place. I'd look on StackOverflow, or post a question there.

Okay, I found an answer. Thanks!

@silas229 Can you please post your solution here?

could you please tell me how did you fixed that problem here?

This problem occurs due to the reason of running _different PHP version on the same PC_,

Pre-Requiste,

Laravel 5.7 server requirement is PHP version > 7.1
check this link = https://laravel.com/docs/5.7/installation#server-requirements

For Eg,

1)I had WAMPP installed with PHP 7.1 and 5.6, with active PHP Version of 7.1, installed globally with environment variable of the user/system
2) I had a laragon running PHP version 7.2,

I installed laravel using command line and tries to execute php artisan serve or any php artisan command
command line shows

PHP Parse error: syntax error, unexpected '=' in /www/computernetworks/vendor/laravel/framework/src/Illuminate/Support/Arr.php on line 388

so basically everything seems to be good as you see your PHP version on the web will be 7.2 but in my case when i check PHP version in command line using
php -v
it was displaying PHP Version as 7.1

So do one thing do remove the enviroment variable with global PHP environment.
Everything will work fine then.
Note : try to use one PHP version in your PC

thank you so much!!
Monisha Ranjan
2nd year, CSE
Indian Institute of Information Technology, Guwahati

On Sat, May 25, 2019 at 9:04 PM Syed Umer Hasan notifications@github.com
wrote:

This problem occurs due to the reason of running different PHP version on
the same PC,
Pre-Requiste,
Laravel 5.7 server requirement is PHP version > 7.1
check this link =
https://laravel.com/docs/5.7/installation#server-requirements
For Eg,
1)I had WAMPP installed with PHP 7.1 and 5.6, with active PHP Version of
7.1, installed globally with environment variable of the user/system
2) I had a laragon running PHP version 7.2,

I installed laravel using command line and tries to execute php artisan
serve
or any php artisan command
command line shows

PHP Parse error: syntax error, unexpected '=' in
/www/computernetworks/vendor/laravel/framework/src/Illuminate/Support/Arr.php
on line 388
so basically everything seems to be good as you see your PHP version on
the web will be 7.2 but in my case when i check PHP version in command line
using
php -v
it was displaying PHP Version as 7.1

So do one thing do remove the enviroment variable with global PHP
environment.
Everything will work fine then.
Note : try to use one PHP version in your PC

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/laravel/framework/issues/26177?email_source=notifications&email_token=AJMZRKPP3SKYULQ4OWCRB53PXFMBHA5CNFSM4F5W57QKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWHT6WI#issuecomment-495927129,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AJMZRKM7PBZKU4OZPBUV65DPXFMBHANCNFSM4F5W57QA
.

Was this page helpful?
0 / 5 - 0 ratings