Anif Zarus
Anif Zarus

Reputation: 45

Not able to generate php artisan key after copying .env file

i had unextracted a project file from git and i want to use it in the local server but when i copy paste the .env and run the command to generate the key. their seems to be an error.

i tried installing auto-dumpload command but it doesnt seem to work

php artisan key:generate  

ErrorException : file_get_contents(C:\Users\Anifz\React\getfyt-webapp-master.env): failed to open stream: No such file or directory

at C:\Users\Anifz\React\getfyt-webapp-master\vendor\laravel\framework\src\Illuminate\Foundation\Console\KeyGenerateCommand.php:96 92| { 93| file_put_contents($this->laravel->environmentFilePath(), preg_replace( 94| $this->keyReplacementPattern(), 95| 'APP_KEY='.$key, 96| file_get_contents($this->laravel->environmentFilePath()) 97| )); 98| } 99| 100| /**

Exception trace:

1
file_get_contents("C:\Users\Anifz\React\getfyt-webapp-master.env") C:\Users\Anifz\React\getfyt-webapp-master\vendor\laravel\framework\src\Illuminate\Foundation\Console\KeyGenerateCommand.php:96

2
Illuminate\Foundation\Console\KeyGenerateCommand::writeNewEnvironmentFileWith("base64:psZqTYKIKLRKPOhzVWUWZ2pny7A/nb4ArWeklrKWofE=") C:\Users\Anifz\React\getfyt-webapp-master\vendor\laravel\framework\src\Illuminate\Foundation\Console\KeyGenerateCommand.php:80

Please use the argument -v to see more details.

Upvotes: 1

Views: 6427

Answers (2)

I think .env file not exist ,if exist file copy one from .env.examle and set name as .env

Exec this code

php artisan key:generate

Maybe u want clear cache if want it u can with below code

php artisan cache:clear

Upvotes: 0

Adesh Khanna
Adesh Khanna

Reputation: 242

The Following are the steps that you should follow -

  1. extract the project.
  2. copy .env.example to .env
  3. run composer install
  4. then run php artisan key:generate

Upvotes: 2

Related Questions