RE: [PHP-GENERAL] New header function behaviour in PHP4 ??

From: Date: Tue, 20 Jun 2000 14:03:39 +0000
Subject: RE: [PHP-GENERAL] New header function behaviour in PHP4 ??
Groups: php.general 
Request: Send a blank email to php-general+get-2301@lists.php.net to get a copy of this message
Hola, Have you consider using Netscape to test these scripts? Some versions of IE do behave wird, I have similar problems using ASP to force expiration of a page. Eduardo Jordán G. Webmaster -----Original Message----- From: Graham Isted [SMTP:graham@selenia.co.uk] Sent: Tuesday, June 20, 2000 4:48 AM To: php-general@lists.php.net Subject: [PHP-GENERAL] New header function behaviour in PHP4 ?? Hi I've been writing a shop using PHP / PHPLIB / APACHE, developing on Windows for a BSD server. I recently upgraded to PHP4 on my Windows machine, but my server provider is still at PHP3. I have noticed what I think is difference to the HEADER function behaviour in PHP4: I didn't want any of my pages to be cached, so I've set the PHPLIB session to allowcache=no, which at version 7.2b sends the following HTTP cache-related HEADERS: default: 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: no-cache"); header("Cache-Control: post-check=0, pre-check=0"); header("Pragma: no-cache"); break; In PHP4, this works fine, but using IE5 on PHP3 on the server, when I go BACK on the browser then IE gets the page from cache, despite the expiry date being in the past. The cache-related headers which I see returned if I Telnet to the relevant hosts are: FOR PHP3: Expires: Mon, 26 Jul 1997 05:00:00 GMT Last-Modified: Mon, 19 Jun 2000 09:59:38 GMT Cache-Control: post-check=0, pre-check=0 Pragma: no-cache FOR PHP4: Cache-Control: no-cache, post-check=0, pre-check=0 Expires: Mon, 26 Jul 1997 05:00:00 GMT Pragma: no-cache Last-Modified: Mon, 19 Jun 2000 10:18:16 GMT I found I could get round this problem on IE5 on PHP3 by changing PHPLIB session.inc to: default: 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: no-cache"); # header("Cache-Control: post-check=0, pre-check=0"); header("Pragma: no-cache"); break; .. or .... default: 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: no-cache"); header("Cache-Control: no-cache, post-check=0, pre-check=0"); header("Pragma: no-cache"); break; When I use the latter of the above variants, the returned cache-related headers are: FOR PHP3 Expires: Mon, 26 Jul 1997 05:00:00 GMT Last-Modified: Tue, 20 Jun 2000 08:43:40 GMT Cache-Control: no-cache, post-check=0, pre-check=0 Pragma: no-cache (only change is of course the addition of NO-CACHE in the Cache-Control header) FOR PHP4 Cache-Control: no-cache, post-check=0, pre-check=0 Expires: Mon, 26 Jul 1997 05:00:00 GMT Pragma: no-cache Last-Modified: Mon, 20 Jun 2000 08:57:00 GMT (ie no change) I would have to assume therefore, that PHP4's HEADER function is behaving differently from that in PHP3 (perhaps it is concatenating Cache-Control statements where there is more than one!?) Can someone from the PHP Dev team possibly clarify exactly what the internals of the HEADER function do Thanks GRAHAM ISTED

« previous php.general (#2301) next »