title: Environment variables and artisan not working on production server
body: <p>I am using Github to deploy my sites to my production server. Because of this I don't want to be storing .env.*.php files everything so they're in my .gitignore.</p>
  
  <p>Within each environment directory I've set the database config to use <code>getenv()</code>, for example:</p>
  
  <pre><code>&lt;?php
  
  'connections' =&gt; array(
  
      'mysql' =&gt; array(
          'driver'    =&gt; 'mysql',
          'host'      =&gt; getenv('DB_HOST'),
          'database'  =&gt; getenv('DB_NAME'),
          'username'  =&gt; getenv('DB_USERNAME'),
          'password'  =&gt; getenv('DB_PASSWORD'),
          'charset'   =&gt; 'utf8',
          'collation' =&gt; 'utf8_unicode_ci',
          'prefix'    =&gt; '',
      ),
  
  
  ),
  
  );
  </code></pre>
  
  <p>I've then gone in to the apache conf file for my virtual hosts and set the environment variables, like so:</p>
  
  <pre><code>SetEnv DB_HOST ***.***.***.***
  SetEnv DB_NAME database
  SetEnv DB_USERNAME databaseuser
  SetEnv DB_PASSWORD databasepass
  </code></pre>
  
  <p>This all works perfectly on the production server.</p>
  
  <p>However, I've just manually imported the database at the moment rather than using <code>php artisan migrate</code> because it doesn't work.</p>
  
  <p>I know it doesn't work because it's not hitting apache so the variables aren't being set, but I've tried numerous ways in order to try and get around this issue but I've have no luck as of yet.</p>
  
  <p>I've tried forcing the environment to see if it can get the variables by using <code>php artisan --env=production migrate</code></p>
  
  <p>I've also tried checking that it's using the correct environment by running <code>php artisan env</code> and it's using the production environment which is correct.</p>
  
  <p>My next idea was to create a .env.production.php file manually on the production server. I created one and used getenv() just in case it worked like this, but the same error occurred, so I tried setting the variables manually without using getenv() and I've still had no luck.</p>
  
  <p>Any ideas would be greatly appreciated.</p>