Reading apache connection timeout from PHP
I'm having some trouble and searched for the solution in the $_SERVER
and $_SESSION
variables, but couldn't find it. However, in the phpinfo()
i found Timeouts Connection: 300 - Keep-Alive: 15
.
Asuming that is what i am searching for (the number of seconds of inactivity before apache closes the connection), is there any other开发者_如何学编程 way of reading it?
Thanks.
See the apache_response_headers
function, and also the accompanying comments.
This works for me:
<?php
flush();
$apache_headers = apache_response_headers();
//echo '<pre>' . print_r($apache_headers, true) . '</pre>';
preg_match('/timeout=(\d+)/', $apache_headers['Keep-Alive'], $matches);
echo $matches[1];
?>
there exist funcitons ini_get, ini_set for reading and writing php.INI values
精彩评论