File README.default_socket_timeout of Package php7
Scope of default_socket_timeout Directive
=========================================
default_socket_timeout do not work for SSL connections. This is long
standing feature request in PHP upstream bugzilla, see PHP bug #41631.
To sum up,
ini_set("default_socket_timeout", $time);
fopen($https_url, "r");
do not work as intended in the contrast to
ini_set("default_socket_timeout", $time);
fopen($http_url, "r");
Socket timeout for SSL connections can be set successfully when
libcurl trough curl PHP extension is used:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $https_url);
curl_setopt($ch, CURLOPT_TIMEOUT, $time);
curl_exec($ch);
curl_close($ch);