title: Laravel 5: run migrations on server environment, not local
body: <p>I have a simple set of database migrations created within my Laravel 5 application, and they run nicely on my local development environment. </p>
  
  <p>Now its time to run to run the migration on my new production server environment. I have configured the DB connection and deployed the app, and the app sees the database, but there are no tables - so migrations need to be run. </p>
  
  <p>The following command, I believe, should run the migrations using the "production" environment, which is set up with the remote DB connection details:</p>
  
  <pre><code>php artisan --env=production migrate 
  </code></pre>
  
  <p>The migration works, but it runs on the local environment! Here is the environment file for my production environment(using amazon elastic beanstalk service) : </p>
  
  <blockquote>
    <p>.elasticbeanstalk.env </p>
  </blockquote>
  
  <pre><code>APP_ENV=production
  APP_DEBUG=true
  APP_URL=&lt;myappname.elasticbeanstalk.com&gt;
  
  DB_HOST=&lt;myapp.amazonserveraddress.amazonaws.com:3306&gt;
  DB_DATABASE=&lt;mydbname&gt;
  DB_USERNAME=&lt;mydbusername&gt;
  DB_PASSWORD=&lt;mydbpassword&gt;
  </code></pre>
  
  <p>So either my environment file is not configured correctly, or artisan is not able to switch to that environment. I could change my .env file (local development environment, named "local") to connect to the remote, production DB, but I want to properly use Laravels environments. </p>
  
  <p>What am I missing? Why does the migration always run on "local"? </p>
  
  <p>Thanks. </p>