title: SQLSTATE[HY000] [2002] No such file or directory when executing a command on Elastic Beanstalk / Laravel
body: <p>I have a production app in Laravel 5.1 / AWS Elastic Beanstalk.</p>
  
  <p>As I have several environment, and automatic deployment, I don't use .env, but I define my environment variables <a href="http://docs.aws.amazon.com/gettingstarted/latest/deploy/envvar.html" rel="nofollow noreferrer">directly on server</a>:</p>
  
  <p>What happens is when the code is deployed to Elastic beanstalk, I can't execute no command because environment variables are not resolved.</p>
  
  <p>So, when I execute:</p>
  
  <pre><code> php artisan migrate
  </code></pre>
  
  <p>I get :</p>
  
  <pre><code>[PDOException]                                    
  SQLSTATE[HY000] [2002] No such file or directory
  </code></pre>
  
  <p>In this <a href="https://stackoverflow.com/questions/21587320/laravel-enviroment-when-on-command-line-different-to-in-browser">post</a>, user has the exact same issue as I have, but he resolves it making a .environment which contains vars for all his environments. I don't like it so much.</p>
  
  <p>Then, if I put it in .gitignore, continuous deployment will never deploy it. </p>
  
  <p>I don't know what to do, and wouldn't like to include my db connection settings in my git...</p>