designerdarpan
designerdarpan

Reputation: 307

How to fix laravel APP_KEY error in production in 000webhost?

I am setting up laravel 5.4 application on 000webhost. And i keep on getting this error "The only supported ciphers are AES-128-CBC and AES-256-CBC with the correct key lengths"

I searched for answers on stackoverflow as well github pages and tried all the answers but couldn't work it out. I tried deleting .env file and generating key but didn't seems to work.

composer update
php artisan key:generate
php artisan config:cache
php artisan cache:clear

The base64 key as in APP_KEY exceeds 32 characters . I dont understands what is bugging the application

Upvotes: 2

Views: 1721

Answers (2)

designerdarpan
designerdarpan

Reputation: 307

.env file is disabled for some reason in 000webhost which doesnt correspond to key value that is in config/app.php . So, i solved the problem in following way .

In config/app.php there is a line 'key' => env(APP_KEY) i altered the line as 'key'=>env(APP_KEY,'base64key').

Also in similar way your database may not work in 000webhost for which in same way you need to change the values of your database username, password and dbname as well as host in config/database.php same as above.

Upvotes: 0

Man87
Man87

Reputation: 131

Run the command php artisan key:generate

And then clear the config cache :- php artisan config:clear

Please let me know in case of any queries.

Also please check in config/app.php After key is generated it should not be :- 'key' => env('32charshere')

Rather than that it should be 'key' => 32charshere

Thanks

Upvotes: 1

Related Questions