You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by "[AOE] Maniac" <ma...@armyops-europe.homeip.net> on 2003/10/30 13:10:48 UTC

[users@httpd] Webserver is caching .php files.

Heya alltogether,

we have a little problem with our Apache Webserver (running 1.3.26) and PHP 4.1.2.
The situation is quite simple:

A .php script is being constantly called by a flash movie (same with http refresh) and checks for some database variables.
Though the content of the php out changes during these updates, the server won't recognize it and return a cached - and therefore old - php file.

Globally caching isnt enabled at all. No proxy servers are running.

The problem could be solved when turning on the MS INet Explorer cache option to check the page everytime, but since most default installations are set to automatically, we have a problem here.

Driving a little windows test webserver (KeyFocus Webserver), it contained an option to assign all CGI output with a "nocache" header, which solved the problem.

Unfortunately I do not know any corresponding option under the Apache environment, so I ask for you help.

Many thanks in advance,
Jan Dubber from Germany.




---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Webserver is caching .php files.

Posted by Robert Andersson <ro...@profundis.nu>.
[AOE] Maniac wrote:
> The problem could be solved when turning on the MS INet Explorer
> cache option to check the page everytime, but since most default
> installations are set to automatically, we have a problem here.

Well, the problem then is that IE will deliver it from its cache, not
Apache.

Easiest workaround is to modify the Flash movie to append some random junk
onto the URI, so each request is unique, eg:
http://yourhost/path/to/moviescript.php?keys=values&junk=248273942734871

You may be able to set some headers in the PHP script, like David suggested,
to cause IE to not put it in its own cache. However, I wouldn't really trust
that as you would rely on IE's complience to the HTTP standard... ... 'nuff
said.

Regards,
Robert Andersson


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


[users@httpd] Re: Webserver is caching .php files.

Posted by David <da...@sydsvenskan.se>.
So it's not the webserver which is caching, is it?

You can add this to your php-scripts:

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", false);
header("Pragma: no-cache");

before any other output.

/David

[AOE] Maniac wrote:
> Heya alltogether,
> 
> we have a little problem with our Apache Webserver (running 1.3.26) and PHP 4.1.2.
> The situation is quite simple:
> 
> A .php script is being constantly called by a flash movie (same with http refresh) and checks for some database variables.
> Though the content of the php out changes during these updates, the server won't recognize it and return a cached - and therefore old - php file.
> 
> Globally caching isnt enabled at all. No proxy servers are running.
> 
> The problem could be solved when turning on the MS INet Explorer cache option to check the page everytime, but since most default installations are set to automatically, we have a problem here.
> 
> Driving a little windows test webserver (KeyFocus Webserver), it contained an option to assign all CGI output with a "nocache" header, which solved the problem.
> 
> Unfortunately I do not know any corresponding option under the Apache environment, so I ask for you help.
> 
> Many thanks in advance,
> Jan Dubber from Germany.



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org