Framework: Parse error on install

Created on 19 Jun 2018  路  6Comments  路  Source: laravel/framework

  • Laravel Installer Version: 1.1
  • PHP Version: virtualbox 7.1, native 5.6.30
  • Database Driver & Version: Mysql 5.7

Description:

When generating optimized autoload files, installer quits on parse error.

Steps To Reproduce:

laravel new project
cd /project
composer update --ignore-platform-reqs (because this.)

Generating optimized autoload files

IlluminateFoundationComposerScripts::postAutoloadDump
PHP Parse error: parse error in /Users/ccb/Code/zapooca/deploy/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php on line 242

Parse error: parse error in /Users/ccb/Code/zapooca/deploy/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php on line 242

composer.json:
{ "name": "laravel/laravel", "description": "The Laravel Framework.", "keywords": ["framework", "laravel"], "license": "MIT", "type": "project", "require": { "php": "^7.1", "fideloper/proxy": "^4.0", "laravel/framework": "^5.4", "laravel/tinker": "^1.0" }, "require-dev": { "filp/whoops": "^2.0", "fzaninotto/faker": "^1.4", "mockery/mockery": "^1.0", "nunomaduro/collision": "^2.0", "phpunit/phpunit": "^7.0" }, "autoload": { "classmap": [ "database/seeds", "database/factories" ], "psr-4": { "App\\": "app/" } }, "autoload-dev": { "psr-4": { "Tests\\": "tests/" } }, "extra": { "laravel": { "dont-discover": [ ] } }, "scripts": { "post-root-package-install": [ "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" ], "post-create-project-cmd": [ "@php artisan key:generate" ], "post-autoload-dump": [ "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", "@php artisan package:discover" ] }, "config": { "preferred-install": "dist", "sort-packages": true, "optimize-autoloader": true, "platform": { "php": "5.6.30" } }, "minimum-stability": "dev", "prefer-stable": true }

Most helpful comment

In case anyone runs into this issue later, I'm going to write a bit down about how to address it even though it's been discussed on Twitter.

Laravel's installer, and the rest of its tools, require a modern version of PHP, and 5.6 is no longer supported by PHP as of January 2017 (PHP EOL schedule).

It looks based on your steps that the problem didn't happen during the installer, but actually composer update; I would recommend running that from within your VM.

And if anyone runs into this problem and isn't using a VM, that means you'll need to use an older version of Laravel that's compatible with your version of PHP and then take on the risks of using older PHP and older Laravel, or just upgrade PHP on your local machine.

All 6 comments

Why are you using PHP 5.6 instead of 7.1?

Because until sometime later this fall, at least half my clients depend on me using php 5.6 on my local machine.
There should be no need to upgrade that using Homestead for Laravel.
Edit: and if I do need to upgrade my entire computer to run the installer, it should say so in the docs.

Wow. Closed already. Thanks for the help!

Hi @carolinecblaker,

It looks like the version of Laravel you are attempting to run requires PHP 7.1 unfortunately. Sorry for the inconvenience.

In case anyone runs into this issue later, I'm going to write a bit down about how to address it even though it's been discussed on Twitter.

Laravel's installer, and the rest of its tools, require a modern version of PHP, and 5.6 is no longer supported by PHP as of January 2017 (PHP EOL schedule).

It looks based on your steps that the problem didn't happen during the installer, but actually composer update; I would recommend running that from within your VM.

And if anyone runs into this problem and isn't using a VM, that means you'll need to use an older version of Laravel that's compatible with your version of PHP and then take on the risks of using older PHP and older Laravel, or just upgrade PHP on your local machine.

Thanks @taylorotwell

@mattstauffer Running it from inside the virtual machine was what I needed to do. Solved!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kerbylav picture kerbylav  路  3Comments

klimentLambevski picture klimentLambevski  路  3Comments

RomainSauvaire picture RomainSauvaire  路  3Comments

lzp819739483 picture lzp819739483  路  3Comments

digirew picture digirew  路  3Comments