Ad

After Copying Laravel From One PC To Another It Shows A Strange Error From Helpers.php

- 1 answer

When I copied the laravel folder from one PC to another and tried to run it, it shows the following error:

Parse error: syntax error, unexpected '[' in C:\xampp\htdocs\accounts\vendor\laravel\framework\src\Illuminate\Foundation\helpers.php on line 383

The same file is working well in the source PC, but in the destination PC it is not.

I have googled it, but no help.

So I tried to make it online. Even though I have changed the name of the database in database.php file in the production server it takes the old database only.

Can anyone help me resolve this?

Ad

Answer

On other PC you have PHP < 5.4.

http://php.net/manual/en/language.types.array.php

As of PHP 5.4 you can also use the short array syntax, which replaces array() with [].

So, most probably, on line 383 you have an array with new [] syntax.

Solution is to upgrade PHP, PHP 5.3 is not supported anymore: http://php.net/supported-versions.php

Ad
source: stackoverflow.com
Ad