Framework: I get error messages while installing laravel by the composer

Created on 16 Nov 2016  路  10Comments  路  Source: laravel/framework

  • Laravel Version: 5.3.*
  • PHP Version: 7.0
  • Database Driver & Version: not used

Description:

I get error messages below while installing laravel by the composer:

...
Writing lock file
Generating autoload files
> Illuminate\Foundation\ComposerScripts::postUpdate
> php artisan optimize
PHP Parse error:  syntax error, unexpected '.', expecting '&' or variable (T_VARIABLE) in /home/laptop/Dev/tasix.app/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php on line 475

Parse error: syntax error, unexpected '.', expecting '&' or variable (T_VARIABLE) in /home/laptop/Dev/tasix.app/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php on line 475
Script php artisan optimize handling the post-update-cmd event returned with error code 255

In the vendor/.../helpers.php file I found those lines of broken code [475-478]:

// ...
    function event(...$args)
    {
        return app('events')->fire(...$args);
    }
// ...

Steps To Reproduce:

I just executed only one command:
php7.0 /usr/local/bin/composer create-project --prefer-dist laravel/laravel test.app

Most helpful comment

@zvermafia

Problem isn't in PHP versions! Please, look at broken code.
What do you think, code written correctly?
P.S. I'll try to install through homestead (v0.5.0)...

// ...
    function event(...$args)
    {
        return app('events')->fire(...$args);
    }
// ...

If you're refering to the ... that's the splat operator and it's correctly wrritten.

You must have PHP >= 5.6.4

All 10 comments

You must have PHP >= 5.6.4

I just believe the composer doesn't use your php7.0 version when installing, although you run it using php7.0 command. Do you use multiple php versions?

Problem isn't in PHP versions! Please, look at broken code.

What do you think, code written correctly?

_P.S. I'll try to install through homestead (v0.5.0)..._

@zvermafia

Problem isn't in PHP versions! Please, look at broken code.
What do you think, code written correctly?
P.S. I'll try to install through homestead (v0.5.0)...

// ...
    function event(...$args)
    {
        return app('events')->fire(...$args);
    }
// ...

If you're refering to the ... that's the splat operator and it's correctly wrritten.

You must have PHP >= 5.6.4

You need to make sure you're using a proper version of PHP, please continue on the forums as we try to keep this repo for bug reporting only.

I'm sorry :(
I didn't know about of the splat operator (thanks @fernandobandeira), I thought it a bug/typo...

Hi there, I got the same problem,

php artisan
Parse error: parse error in /Users/g../Documents/websites/New/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php on line 233

I installed php 7.1 but after installing composer then laravel, checking the php version using _php -v_ in Terminal,
screen shot 2017-12-05 at 23 01 12 php 5.5.38
Is there anyone who knows how to install php in this case?

@Gedeonnibango1 https://php-osx.liip.ch/ should work. If you have any more issues regarding running the correct PHP version, please refer to the forums, since this is intended for bug reports only.

@CupOfTea696 Than you so much indeed. PHP https://php-osx.liip.ch/ Worked.

How about window, how to resolve?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Anahkiasen picture Anahkiasen  路  3Comments

Fuzzyma picture Fuzzyma  路  3Comments

RomainSauvaire picture RomainSauvaire  路  3Comments

felixsanz picture felixsanz  路  3Comments

ghost picture ghost  路  3Comments