Alberto Mnemon
Alberto Mnemon

Reputation: 117

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.

Upvotes: 0

Views: 1708

Answers (2)

thirtydot
thirtydot

Reputation: 228182

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];

?>

Upvotes: 1

heximal
heximal

Reputation: 10517

there exist funcitons ini_get, ini_set for reading and writing php.INI values

Upvotes: 0

Related Questions