Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

waisir's avatar

L5 "php artisan migrate --env=testing" not work as expected.

When I run command php artisan migrate --env=testing, it shows Nothing to migrate..

//The content of file .env

APP_ENV=local
APP_DEBUG=true
APP_KEY=1daerm3gPSoRJoQaDDRWeVwSRBaww0Ze

DB_HOST=localhost
DB_DATABASE=db_local
DB_USERNAME=my_user
DB_PASSWORD=my_password

Should I change DB_DATABASE value db_local to db_testing ... each time before I run the command php artisan migrate --env=testing?

Is there any feature about L5's env config I don't know?

What's the best practice to do with it?

0 likes
2 replies
ahuggins's avatar

The --env flag refers to your environment...which in your .env is set to local.

So you should try php artisan migrate --env=local, but I am not sure if you even need to pass the --env flag at all. If you are migrating on a local server (vm or AMPPS, MAMP, WAMP etc), php artisan migrate will use the credentials in your .env file. If you are running it on a remote (most likely your production) server, then php artisan migrate will again use the credentials in the .env file on your remote.

Please or to participate in this conversation.