Skip to content

Laravel 9 command serve does not use custom .env file #40978

@fbsanchez

Description

@fbsanchez
  • Laravel Version: 9.0.1
  • PHP Version: 8.0.15
  • Database Driver & Version: php-mysqlnd-8.0.15-1.fc35 connected to mysql:8 (docker) / sqlite3

Description:

command php artisan serve --env=testing seems not to be working since it is still using default .env file instead.

Steps To Reproduce:

With mysql running using default .env file (configured against mysql)
image

With mysql stopped using custom .env.testing file (configured against sqlite)
image

With mysql stopped moving .env.testing to .env file
image

Another easy test is not having a .env file at all and specify custom one:

image

This time results into a err 500

local.ERROR: No application encryption key has been specified. {"exception":"[object] (Illuminate\\Encryption\\MissingAppKeyException(code: 0): No application encryption key has been specified. at /tmp/laravel-serve-bug/vendor/laravel/framework/src/Illuminate/Encryption/EncryptionServiceProvider.php:79)

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions