[code]
<?php
header("Cache-Control: private, must-revalidate, max-age=3600, post-check=3600, pre-check=3600");
////header("Last-Modified: " . gmdate("D, d M Y H:i:s",getlastmod())." GMT");
////ini_set("last_modified","1");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
flush(); // <= (*1)
...
if (!headers_sent()) {
header('Content-Type:text/html; charset='._CHARSET);
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
//header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: private, no-cache');
header('Pragma: no-cache');
}
...
?>
[/code]
headers_sent() does not evaluate it as true, unless the flush()(*1) has been done.
It seems that it does not mean header was sent unless a header output is taken
out to the exterior of PHP.
Apache 2.0.53 (prefork)
PHP 5.0.3 (server module)
... And XOOPS 2.0.9.2
I had seldom paid attention to flush() on PHP which is not C.
However, it might have been a required thing.
[pre]
$ curl --cookie PHPSESSID=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -i \
"http ://myhost.mydomain/xoops/modules/test.php?i=1" | less
% Total % Received % Xferd Average Speed Time Curr.
Dload Upload Total Current Left Speed
0 0 0 0 0 0 0 0 --:--:-- 0:00:00 --:--:-- 0
HTTP/1.1 200 OK
Date: Fri, 22 Apr 2005 05:00:11 GMT
Server: Apache
X-Powered-By: PHP/5.0.3
Set-Cookie: PHPSESSID=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: private, must-revalidate, max-age=3600, post-check=3600, pre-check=3600
Pragma: no-cache
Last-Modified: Fri, 22 Apr 2005 05:00:11 GMT
Transfer-Encoding: chunked
Content-Type: text/html
[/pre]
(*)"http :" is "http:" in fact.