title: Setting environment variables within PHP works for one user but not another
body: <p>A user has been helping me with a problem (<a href="https://stackoverflow.com/q/59517271/1166898">How to force a curl request in a PHP method to fail for a unit test</a>). They suggested doing <code>putenv('all_proxy=localhost:5678');</code> so I can force <code>curl</code> to fail dynamically in a unit test (I changed <code>http_proxy</code> / <code>https_proxy</code> to <code>all_proxy</code> because it does all protocols).</p>
  
  <p>This works perfectly on their Ubuntu box, but I can't get it to work on <s>either</s> my Windows 10 box <s>or Ubuntu box</s>. If I set <code>all_proxy</code> from the command prompt, the <code>curl</code> requests always fail, so it is taking notice of the variable when it can find it. I changed their script slightly and that seems to have got it working on Ubuntu.</p>
  
  <p>Is there some setting in <code>php.ini</code> that controls whether <code>putenv()</code> can override variables from the environment or not? Why does the dynamic environment variable work on <s>their setup but not on either of mine</s> Ubuntu but not Windows?</p>
  
  <h3>Test script</h3>
  
  <pre class="lang-php prettyprint-override"><code>&lt;?php
  
  function search() {
    $url = 'x3m.dev';
  
    $curl = curl_init();
    curl_setopt_array($curl, [
      CURLOPT_RETURNTRANSFER =&gt; 1,
      CURLOPT_URL =&gt; $url,
    ]);
    $data = curl_exec($curl);
  
    if (!$data) {
      throw new Exception('An error occurred while trying to process the request.');
    }
    return $data;
  }
  
  function do_curl_request() {
    echo getenv('all_proxy') . "\n\n";
    try {
      echo search();
    }
    catch (Exception $e) {
      echo $e-&gt;getMessage();
    }
    echo "\n\n";
  }
  
  echo "========== first run without proxy\n";
  do_curl_request();
  
  putenv('all_proxy=localhost:5678');
  echo "========== second run with proxy override\n";
  do_curl_request();
  </code></pre>
  
  <p>It should work the first time and throw an exception the second time. On Windows it works both times if <code>all_proxy</code> is not set as a Windows environment variable, and throws an exception both times if <code>all_proxy</code> is set.</p>
  
  <h3>Windows (incorrect)</h3>
  
  <pre><code>========== first run without proxy
  
  
  &lt;html&gt;
  &lt;head&gt;&lt;/head&gt;
  &lt;body&gt;.&lt;/body&gt;
  &lt;/html&gt;
  
  ========== second run with proxy override
  localhost:5678
  
  &lt;html&gt;
  &lt;head&gt;&lt;/head&gt;
  &lt;body&gt;.&lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <h3>Ubuntu (correct)</h3>
  
  <pre><code>========== first run without proxy
  
  
  &lt;html&gt;
  &lt;head&gt;&lt;/head&gt;
  &lt;body&gt;.&lt;/body&gt;
  &lt;/html&gt;
  
  ========== second run with proxy override
  localhost:5678
  
  An error occurred while trying to process the request.
  </code></pre>