title: Why is getenv() only returning a variable when run from the terminal, not via web server
body: <p>I'm trying to use a custom environment variable for environment detection in my PHP application. I've set the variable system-wide in <strong>/etc/environment</strong>, rebooted, and checked that it is visible through the terminal using <strong>printenv</strong>.</p>
  
  <p>I've also checked that it is visible when running PHP at the command line:</p>
  
  <pre><code>php -r 'echo getenv("LOCAL_DEVELOPMENT");'
  
  //returns 'true' as expected
  </code></pre>
  
  <p>But when I try from a web page script, the variable is not found:</p>
  
  <pre><code>var_dump(getenv("LOCAL_DEVELOPMENT"));
  
  //returns 'boolean false' (not expected)
  </code></pre>
  
  <p>I'm using Ubuntu 12.04 LTS with PHP 5.4 and Apache 2.2.</p>
  
  <p>Why is the variable not visible from a web script, and how do I fix this?</p>