touhid udoy
touhid udoy

Reputation: 4442

php artisan key:generate doesn't do anything

I tried previous questions and answers before in SO, but nothing solves my problem.

  1. I clone a new project in my Mac. Then composer update.

  2. Everything is ok so far. But when i manually create .env file via touch .env

  3. and type php artisan key:generate. Nothing happens. Absolutely nothing. No error and .env is blank as it was before. I had the same error. I tried applying sudo, nothing happens. It just says: Application key set successfully.

How to solve this problem?

Upvotes: 3

Views: 5579

Answers (2)

Datadimension
Datadimension

Reputation: 1045

I have my own settings in .env, so did not want to copy the .env.example file. Simple fix for me - my current .env had a line

APP_KEY = somewrongkey

and

php artisan key:generate

reported success, however it, as above, did not save in .env. The problem was actually the space characters. Changing to

APP_KEY=

Then

php artisan key:generate

Showed a new key in .env

APP_KEY=base64:SgFJ7ClPfCczedxKwiIvQ58ZmMaGDxvOfsTRNfzLYww=

Upvotes: 0

Kirit
Kirit

Reputation: 415

@Touhidul Islam You have to copy .env.example file and rename it to .env then run php artisan key:generate command

Upvotes: 5

Related Questions