1

I use Laravel 6.2 with valet and PHP 7.3.12

The problem is I want to change DB_DATABASE=laravel to DB_DATABASE=something_else in .env file but it doesn't reload the new .env value at all

I have already tried this command:

php artisan config:clear
php artisan config:cache

but it still doesn't change at all.

I even try to add a new key to .env file and query it in Tinker and the new key doesn't add as well.

Udhav Sarvaiya
  • 9,380
  • 13
  • 53
  • 64
Ch.Suparerk
  • 39
  • 1
  • 8

4 Answers4

2

After completion of .env edit, You can clear the configuration cache with the following artisan command: php artisan config:cache

Use php artisan key:generate it will generate the new key to your .env file


NOTE: If there is still error then you do not need your restart computer just try this:

If you are using the PHP's default web server (eg. php artisan serve) you need to restart your server

OR

If you have used XAMPP then restart your Apache server

Udhav Sarvaiya
  • 9,380
  • 13
  • 53
  • 64
1

I just restart my computer at first it doesn't work then I did php artisan config:cache and it works now.

Ch.Suparerk
  • 39
  • 1
  • 8
1

whenever you want to change content .env file

run php artisan cache:clear command to get newly added values

Saurabh Mistry
  • 12,833
  • 5
  • 50
  • 71
0

Restarting you computer has nothing to do with it.

If you are working on a local environment then please stop your development server by pressing ctrl+c and then restart the application by running php artisan serve.