title: PHP file can access global net from terminal, but not from apache
body: <p>I have a following problem. We have a private server running on CentOS in our corporate network. The proxy server is on Windows running NTLMV2 authentification.</p>
  
  <p>So, I installed cntlm on my CentOS server in order to have access to the required resources. Everything worked fine. By everything I mean, that curl, wget and yum work correctly with this cntlm proxy when ran from the terminal.</p>
  
  <p>However, one thing does not work. We also have Apache + PHP + MySQL instance running on this server. And the trick is - it cannot access the proxy somehow. Here is the sample PHP file working with curl:</p>
  
  <pre><code>&lt;?php
  $url = "http://www.google.com";
  $ch = curl_init();
  $timeout = 5;
  curl_setopt($ch, CURLOPT_URL, $url);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
  curl_setopt($ch, CURLOPT_HEADER, TRUE);
  curl_setopt($ch, CURLOPT_PROXY, 'http://127.0.0.1:3128');
  $data = curl_exec($ch);
  if ($data == FALSE) echo curl_error($ch);
  curl_close($ch);
  var_dump($data);
  ?&gt;
  </code></pre>
  
  <p>When I execute this from the command line:</p>
  
  <pre><code>php curl.php | tail -n 10
  </code></pre>
  
  <p>Everything works great, it can access the global resource via this proxy. However, if I run it from the browser page, Apache cannot connect, giving the error "Failed to connect to 127.0.0.1: Permission denied"</p>