G
G
gocha112017-03-10 12:04:14
Laravel
gocha11, 2017-03-10 12:04:14

Why is it throwing an error on artisan command?

Hello everyone, I'm new to this and I'm having a problem!!
I'm trying to make a migration and when I type php artisan migrate:install I get the
following error

PHP Parse error:  syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /var/www/artisan on line 31

Ras chew for the slow-witted answer!
Google did not help, either I'm stupid, or the skis don't go!

Answer the question

In order to leave comments, you need to log in

3 answer(s)
Z
zorca, 2017-03-10
@zorca

Does the PHP version exactly match the requirements of the framework? This is both a question and an answer in one bottle. And we also don't know how to google:

Laravel 5.1 uses the ::class property to get string representations of a fully qualified classname. The error you're seeing is caused by this line
$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
This language feature has been introduced in PHP 5.5 which is a requirement of Laravel 5.1. Your installed PHP version is probably older than 5.5. Try to update your PHP binary.

From here: stackoverflow.com/questions/32205590/laravel-parse...

V
Vladislav Nagorny, 2017-03-10
@esvils

Update PHP.

K
kryamk, 2021-04-08
@kryamk

I had different versions in panel (7.2) and console (5.4).
Run commands from the panel version:
/opt/php/7.2/bin/php artisan cache:clear

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question