title: Joomla site on LAMP server behind proxy cannot access HTTP resource stream
body: <p>Setup:
  1. Joomla 1.5 website on a LAMP server (CentOS 5.2/Apache 2.2/PHP 5.2.9/mysql 5)
  2. Joomla module for currency conversion added. Module uses google finance to convert currency
  3. LAMP stack resides in the intranet behind a proxy. The server environment variables for http_proxy, yum.conf proxy have been setup, and kernel successfully updated.
  4. phpinfo() clearly shows curl is installed
  5. module mentioned in '2.' allows 3 methods to connect to google finance, fread(), file_get_contents() and using the cURL libraries. As the box is behind a proxy, only the cURL libraries method should work. </p>
  
  <p>Problem:
  on a WAMP stack, the curl library method works fine. On the lamp stack, however, the module is unable to communicate with google finance, and throws an error mentioning connect timed out. Here's some code to make it clearer.</p>
  
  <pre><code>if (isset($_GET['process'])) {        
  $url = "http://finance.google.com/finance/converter?a={
  $_GET['a']}&amp;from={$_GET['from']}&amp;to={$_GET['to']}";
  $app-&gt;get_page($url);
  $data = $app-&gt;process();
  }  
  
  function get_page($url) {
  if ($url!='') {
  echo $url;
  $ch = curl_init ();
                      curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
                      curl_setopt($ch, CURLOPT_URL, $url);
                      curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
                      curl_setopt($ch, CURLOPT_BINARYTRANSFER, $this-&gt;binary);
                      $this-&gt;html = curl_exec($ch);
                      curl_close($ch);
              }
      }
  </code></pre>
  
  <p>I even tried adding a curl_setopt($ch, CURLOPT_PROXY,'10.x.xx.xx:8080'); after curl_init(), to no avail. I've compiled apache with libcurl and php enabled, and I need to know the following:
  1. How to instruct php to route outgoing requests(streams) through the proxy?
  2. Do I need to configure cURL (libcurl) with the proxyname and port?
  3. I've switched iptables off, so the linux firewall is not in the picture anymore, is there anything else I need to do to allow outgoing requests?
  4. I've setup the proxy so that my LAMP stack is unblocked for all content, cURL works off the command line, but not from php/apache. What am I missing? Any environment variables? Any switches?</p>
  
  <p>Thanks in advance for your time.</p>
  
  <p>Shrinivas</p>