I have both PHP 7.0 and PHP 5.6 installed on my server (it's a dedicated server with plenty of resources), and outbound requests are very slow when made through PHP 7, but not when made through PHP 5. When testing using cURL in the PHP command line interpreter, a request (for a 33MB file) that takes 1.3 seconds using PHP 5 takes 16.9 seconds when executed on PHP 7 (and I am able to reliably reproduce those results - it isn't just a one-off spike).

The time is taken on the actual download, not on setting up the connection - according to curl_getinfo, while all of the timing (name lookup, connection, start transfer time, etc) are roughly 10x higher in PHP 7 and PHP 5, they are still completely in under a second, so the vast majority of the time is spent actually downloading the file; when the download is interrupted by a cURL timeout, the error message, which indicates the number of bytes received, is roughly proportional to the amount of time that it has spent executing. This has led me to the conclusion that the network speed must somehow be being throttled, but I can't think what would affect PHP 7 (both CLI and FPM), but not PHP 5.

It's not only cURL that is affected by this - trying the same request using a manual socket connection is also very slow (and in fact noticeably slower than cURL, though that might be because cURL can handle compression while the socket connection can't).

The server is running Debian Jessie.

  • Where did you get these multiple versions of PHP? – Michael Hampton Sep 24 '16 at 17:59
  • @MichaelHampton PHP 5.6 is from an official Debian mirror, while PHP 7.0 is from dotdeb. – JackW Sep 24 '16 at 18:30
  • This issue also seems to be affecting requests made to localhost (and actually, localhost seems to be affected even more than a remote host). – JackW Sep 29 '16 at 23:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.