Reputation: 185
I've host a website on http://000webhostapp.com It was working fine since a while and it's showing me this error "production.ERROR: No application encryption key has been specified"
I found out that I would have to run this artisan command
"php artisan key:generate"
to figure it out without downloading my files and run it on my machine. is there any way to do that?
Upvotes: 4
Views: 9858
Reputation: 81
It's not a good way to run command on shared hosting as it can be risky, you should follow standard procee develop your project in local machine and then put it live on production.
Here is the link you can use to run basic command and you can configure further as per your requirement , Snippet to run command on shared hosting
As per this snippet all you have to do is to create 2 routes in your routing file and add logic to run command programatically as described here laravel official doc
Upvotes: 0
Reputation: 1340
This can be helpful for someone,
Since .env is disabled for security reasons. You can generate a key in your local environment and put in your config/app.php
like
'key' => env(APP_KEY, base64_decode('your-key-without-base64:'));
Refer this answer.
Upvotes: 0
Reputation: 499
in your route file.
Route::get('/key', function(){
artisan::call('key:generate');
});
then run the route in your browser
But that won't work in 000webhost
Because .env is disabled for security reasons. You will have to put the key in the Config/app file locate the line
'key' = env(APP_KEY);
Replace it with
'key' = 'your key'
Remember to add more necessary configurations.
Upvotes: 6
Reputation: 11
You should have SSH access for generating key, if not you can ask your hosting provider for running this command.
Upvotes: 0