title: Environment variables and PHP
body: <p>I have an ubuntu server with a handful of custom environment variables set in /etc/environment as per the <a href="https://help.ubuntu.com/community/EnvironmentVariables#System-wide_environment_variables" rel="nofollow noreferrer">ubuntu community recommendation</a></p>
  
  <p>When I use php from the command line I can use php's <code>getenv()</code> function to access this variables.</p>
  
  <p>Also, if I run <code>phpinfo()</code> from the command line I see all of my variables in the ENVIRONMENT section.</p>
  
  <p>However, when trying to access the same data inside processes being run by php5-fpm this data is not available.  All I can see in the ENVIRONMENT section of <code>phpinfo()</code> is:</p>
  
  <pre><code>USER    www-data
  HOME    /var/www
  </code></pre>
  
  <p>I know the command line uses this ini:</p>
  
  <pre><code>/etc/php5/cli/php.ini
  </code></pre>
  
  <p>And fpm uses:</p>
  
  <pre><code>/etc/php5/fpm/php.ini
  </code></pre>
  
  <p>I've not managed to find any differences between the two that would explain why the ENV variables are not coming through in both.</p>
  
  <p>Also if run:</p>
  
  <pre><code>sudo su www-data
  </code></pre>
  
  <p>and then echo the environment variables I am expecting they are indeed available to the www-data user.</p>
  
  <p>What do I need to do to get my environment variables into the php processes run by fpm?</p>