title: PHP CURL timing out but CLI CURL works
body: <p>I am seeing a very bizarre problem with a PHP application I am building.</p>
  
  <p>I have 2 virtual hosts on my development server (windows 7 64-bit) <code>sometestsite.com</code> and <code>endpoint.sometestsite.com</code>.</p>
  
  <p>In my <code>hosts</code> file, I configured <code>sometestsite.com</code> and <code>endpoint.sometestsite.com</code> to point to <code>127.0.0.1</code>.</p>
  
  <p>Everything works when the server was running Apache 2.4.2 with PHP 5.4.9 as a fcgi module.</p>
  
  <p>I then removed Apache and installed nginx-1.2.5 (windows build). I got php-cgi.exe running as a service and everything seems to work fine.</p>
  
  <p>The problem is that a CURL call from <code>sometestsite.com</code> to <code>endpoint.sometestsite.com</code> that previously worked would time out.</p>
  
  <p>I then moved that piece of code by itself to a small PHP file for testing:</p>
  
  <pre><code>$ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, 'http://endpoint.sometestsite.com/test');
  curl_setopt($ch, CURLOPT_HEADER, 0);
  curl_setopt($ch, CURLOPT_POST, 1);
  curl_setopt($ch, CURLOPT_POSTFIELDS, array('provider' =&gt; urlencode('provider'),
  'key' =&gt; urlencode('asdf')));
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  
  //Execute and get the data back
  $result = curl_exec($ch);
  
  var_dump($result);
  </code></pre>
  
  <p>This is what I receive in the PHP logs:</p>
  
  <pre><code>PHP Fatal error:  Maximum execution time of 30 seconds exceeded in D:\www\test5.php on line 22
  PHP Stack trace:
  PHP   1. {main}() D:\www\test5.php:0
  </code></pre>
  
  <p>However, if I run the same request using CLI CURL (via Git Bash), it works fine:</p>
  
  <pre><code>$ curl -X POST 'http://endpoint.sometestsite.com/test' -d'provider=provider&amp;key=asdf'
  {"test": "OK"}
  </code></pre>
  
  <p>This is quite strange as the PHP is exactly the same version and has the same configuration as when Apache was used.</p>
  
  <p>I am not sure if this is a web server configuration issue or a problem with PHP's CURL yet.</p>
  
  <p>Can anyone provide some insight/past experiences as to why this is happening?</p>