2

I have a shared hosting account on a well known host.

I have my Laravel site uploaded and functioning for the most part. But I had to make an env change. Now I can't get Laravel to see the change.

I know this is common issue. I have tried running the artisan commands to clear config and cache (php artisan config:cache & php artisan cache:clear ) but this fails with an error:

Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /home4/cmatthewc/cvbaptistapp/artisan on line 33

Is there any other way to get Laravel to refresh its cache from env?

TY in advance...

10
  • what version of laravel? Also, thats a PHP error in the artisan file, did you modify it? Commented Jun 29, 2018 at 18:11
  • (Laravel 5.6 ) I did not modify the artisan file. But I have separated the core files from public ones and that might have broken something I am not aware of. Commented Jun 29, 2018 at 18:19
  • wait, does your laravel project have a .env ? Commented Jun 29, 2018 at 18:26
  • yes. I changed the env file for mail and I can't get Laravel to see the new variable values. Commented Jun 29, 2018 at 18:27
  • Was it working prior to this? also, would you mind sharing the new env variables? substitute the values but make them structurally the same. Commented Jun 29, 2018 at 18:30

1 Answer 1

1

THE ISSUE

The issue lies in the php cli version of the server. Laravel 5.6 expects you to have PHP 7.1.3 or greater.

More specifically, the exact reason you're getting this error, from the documentation:

Since PHP 5.5, the class keyword is also used for class name resolution. You can get a string containing the fully qualified name of the ClassName class by using ClassName::class. This is particularly useful with namespaced classes.

And if you look on line 33 in the artisan file in your project root:

$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class); 

And since the server is running 5.4 when you run commands via the CLI, PHP has no idea what the syntax means, so it throws an error.

THE FIX

In order to fix this, you'll need to upgrade your PHP version.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.