[mpm-itk] ITK seems to make PHP's file_get_contents() hang with https URLs.

Rich forums at artfulrobot.uk
Thu Dec 17 14:34:08 CET 2015


Hi,

Long time user of ITK, but have had a few problems since upgrading to 
the version packaged with Debian Jessie (2.4.10).

The one I'm stuck on took me ages to track it down to ITK, which I 
believe is to blame because if I turn it off the problem goes away.

When using PHP (5.6)'s file_get_contents() function with an https URL 
that points to the ITK-enabled Apache 2.4 server, it will hang, 
indefinitely or for a socket timeout of 60s.

Using wireshark and strace I can see that PHP is able to connect and 
receive the data at normal speed, but then just sits waiting. It doesn't 
close the connection for some reason.

My test environment was:

1. Install Debian 8, Apache 2.4, php-cli 5.6
2. Install a valid SSL certificate
3. make a static file available as index.html (the default will do).

And the test is running:

bash$ php -r '$a = 
file_get_contents("https://your-domain-here/index.html"); print 
gettype($a) . "\n";'

Which should return quickly echoing just "string" (this function returns 
FALSE if it fails to download).

Then install apache2-mpm-itk package, enable the module (if that's not 
done automatically for you), restart apache, re-run test.

The command then hangs, possibly returning at 60s, possibly not.


Is there anything that can be done to fix this in configuration? Is it a 
bug?

Thanks,

Rich






More information about the mpm-itk mailing list