title: cURL is very slow on PHP 7 but not PHP 5
body: <p>cURL seems to be significantly slower for me using PHP7.0.11 than it is when just running the request from the command line, or when run within PHP5.6.24. I'm testing it using the following code:</p>
  
  <pre><code>$curl = curl_init();
  curl_setopt($curl, CURLOPT_URL, "https://i.imgur.com/H1zC601.gif");
  curl_setopt($curl, CURLOPT_HTTPGET, TRUE);
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
  $output = curl_exec($curl);
  var_dump(curl_getinfo($curl));
  </code></pre>
  
  <p>In both PHP5 and PHP7's CLI interpreter, and in PHP5 I get</p>
  
  <pre><code>array(26) {
    ["url"]=&gt;
    string(31) "https://i.imgur.com/H1zC601.gif"
    ["content_type"]=&gt;
    string(9) "image/gif"
    ["http_code"]=&gt;
    int(200)
    ["header_size"]=&gt;
    int(597)
    ["request_size"]=&gt;
    int(204)
    ["filetime"]=&gt;
    int(-1)
    ["ssl_verify_result"]=&gt;
    int(0)
    ["redirect_count"]=&gt;
    int(0)
    ["total_time"]=&gt;
    float(1.260002)
    ["namelookup_time"]=&gt;
    float(0.060424)
    ["connect_time"]=&gt;
    float(0.068474)
    ["pretransfer_time"]=&gt;
    float(0.089705)
    ["size_upload"]=&gt;
    float(0)
    ["size_download"]=&gt;
    float(34327108)
    ["speed_download"]=&gt;
    float(27243693)
    ["speed_upload"]=&gt;
    float(0)
    ["download_content_length"]=&gt;
    float(34327108)
    ["upload_content_length"]=&gt;
    float(-1)
    ["starttransfer_time"]=&gt;
    float(0.098354)
    ["redirect_time"]=&gt;
    float(0)
    ["redirect_url"]=&gt;
    string(0) ""
    ["primary_ip"]=&gt;
    string(15) "151.101.124.193"
    ["certinfo"]=&gt;
    array(0) {
    }
    ["primary_port"]=&gt;
    int(443)
    ["local_ip"]=&gt;
    string(14) "my IP"
    ["local_port"]=&gt;
    int(44555)
  }
  </code></pre>
  
  <p>While when running PHP7, I get </p>
  
  <pre><code>array(26) {
    ["url"]=&gt;
    string(31) "https://i.imgur.com/H1zC601.gif"
    ["content_type"]=&gt;
    string(9) "image/gif"
    ["http_code"]=&gt;
    int(200)
    ["header_size"]=&gt;
    int(609)
    ["request_size"]=&gt;
    int(61)
    ["filetime"]=&gt;
    int(-1)
    ["ssl_verify_result"]=&gt;
    int(0)
    ["redirect_count"]=&gt;
    int(0)
    ["total_time"]=&gt;
    float(16.875167)
    ["namelookup_time"]=&gt;
    float(0.252648)
    ["connect_time"]=&gt;
    float(0.260626)
    ["pretransfer_time"]=&gt;
    float(0.280489)
    ["size_upload"]=&gt;
    float(0)
    ["size_download"]=&gt;
    float(34327108)
    ["speed_download"]=&gt;
    float(2034178)
    ["speed_upload"]=&gt;
    float(0)
    ["download_content_length"]=&gt;
    float(34327108)
    ["upload_content_length"]=&gt;
    float(-1)
    ["starttransfer_time"]=&gt;
    float(0.288715)
    ["redirect_time"]=&gt;
    float(0)
    ["redirect_url"]=&gt;
    string(0) ""
    ["primary_ip"]=&gt;
    string(15) "151.101.124.193"
    ["certinfo"]=&gt;
    array(0) {
    }
    ["primary_port"]=&gt;
    int(443)
    ["local_ip"]=&gt;
    string(14) "my IP"
    ["local_port"]=&gt;
    int(55559)
  }
  </code></pre>
  
  <p>The important part being total_time, which is 1.3 seconds in PHP 5 but 16.9s in PHP 7.</p>
  
  <p>When a timeout is set on the request, the number of bytes received is proportional to the timeout - the data is being transferred very slowly, rather than there being some obstruction that is preventing anything from being transferred for a while, then the whole thing being transferred in one go.</p>
  
  <p>The server is running Debian, and I can't seem to reproduce the issue on my Fedora local machine.</p>