PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > php.general > Unsetting a header
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Unsetting a header

Réponse
 
LinkBack Outils de la discussion
Vieux 21/10/2007, 14h55   #1
Richard Heyes
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Unsetting a header

Does anyone know of a way to unset a header? I have an Expires: header
that I believe Apache is setting, and I don't want it. Thanks.

--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and Desk software
that can cut the cost of online support
  Réponse avec citation
Vieux 21/10/2007, 17h18   #2
Richard Heyes
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] Unsetting a header

> Try this never gives me a problem. I use it to keep proxy servers from
> caching.
>
> <?
> header("HTTP/1.1 200 OK");
> header("Status: 200 OK");
> header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); //
> Date in the past
> header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always
> modified
> header("Cache-Control: no-cache, must-revalidate"); //
> HTTP/1.1
> header("Pragma: no-cache");
> // HTTP/1.0
> ?>


Yes but I want to unset an Expires: header and not give a any value.

1. PHP (I believe) is setting an Expires: header.
2. The Expires: header is causing the page to be cached too long,
Longer than the Last-Modified: header would allow.
3. Setting the Expires: header to garbage, eg: Expires: none causes
no caching to occur at all.

Let me reiterate, I want this page to get cached, but not based on an
Expires: header. Rather a Last-Modified header.

--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and Desk software
that can cut the cost of online support
  Réponse avec citation
Vieux 21/10/2007, 18h15   #3
Rafael
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] Unsetting a header

> Let me reiterate, I want this page to get cached, but not based on an
> Expires: header. Rather a Last-Modified header.


Have you tried setting the value to FALSE, NULL, or something else? I
recall having read something along those lines. I'll see if I can find
it again, meanwhile you could experiment a little.

Regards
  Réponse avec citation
Vieux 21/10/2007, 19h20   #4
admin@buskirkgraphics.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut RE: [PHP] Unsetting a header

Try this never gives me a problem. I use it to keep proxy servers from
caching.

<?
header("HTTP/1.1 200 OK");
header("Status: 200 OK");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); //
Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always
modified
header("Cache-Control: no-cache, must-revalidate"); //
HTTP/1.1
header("Pragma: no-cache");
// HTTP/1.0
?>


Richard L. Buskirk


-----Original Message-----
From: Richard Heyes [mailto:richardh@phpguru.org]
Sent: Sunday, October 21, 2007 7:55 AM
To: PHP General List
Subject: [php] Unsetting a header

Does anyone know of a way to unset a header? I have an Expires: header
that I believe Apache is setting, and I don't want it. Thanks.

--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and Desk software
that can cut the cost of online support

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
  Réponse avec citation
Vieux 21/10/2007, 20h17   #5
Richard Heyes
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] Unsetting a header

admin@buskirkgraphics.com wrote:
> Try this never gives me a problem. I use it to keep proxy servers from
> caching.


But I want the page to be cached...

--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and Desk software
that can cut the cost of online support
  Réponse avec citation
Vieux 21/10/2007, 20h18   #6
Richard Heyes
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] Unsetting a header

> Have you tried setting the value to FALSE, NULL, or something else?

Yes, nada I'm afraid.

--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and Desk software
that can cut the cost of online support
  Réponse avec citation
Vieux 21/10/2007, 21h02   #7
Stut
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] Unsetting a header

Richard Heyes wrote:
> admin@buskirkgraphics.com wrote:
>> Try this never gives me a problem. I use it to keep proxy servers from
>> caching.

>
> But I want the page to be cached...


Maybe I'm being dense, but why not set it to what you want it to be?
Clearing it is leaving the decision up to the browser which will not
necessarily have the effect you want for all users.

Incidentally, it might not be possible if Apache is setting it. Not sure
if PHP has the ability to override headers being sent by Apache.

-Stut

--
http://stut.net/
  Réponse avec citation
Vieux 22/10/2007, 12h00   #8
Richard Heyes
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] Unsetting a header

> Maybe I'm being dense, but why not set it to what you want it to be?
> Clearing it is leaving the decision up to the browser which will not
> necessarily have the effect you want for all users.
>
> Incidentally, it might not be possible if Apache is setting it. Not sure
> if PHP has the ability to override headers being sent by Apache.


The two have different effects. The Expires: header proclaims that the
page is good for x hours/minutes/days etc. Whereas the browser can use
the Last-Modified header to figure the staleness for itself. If its
newer than the copy it has, it needs to download the newer copy.

--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and Desk software
that can cut the cost of online support
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 11h04.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,20108 seconds with 16 queries