Bugs in PHP 4.2.2 / APACHE 2.0.40
Found some new bugs in RedHat Linux 8.0 today, with a couple of workarounds. Here is the
deal. Let us suppose that you install RedHat 8.0 and have some PHP scripts you are running...
"BAD" idea.
Stick with RedHat 7.3. The problem is that 8.0 comes with Apache 2, which does
not play nice with PHP yet. It is in fact still considered beta. The first bug I have run
into is that cache control is whacky, exacerbated by what is reportedly an inconsistency
in the way IE caches pages. My biggest problem was with PhpBB, since the codebase is fairly
large. Here is the solution as brought to me by the
nice people
on the phpBB support board...
I'm not running RH8, but RH7.1.
I'm running Apache 2.0.39 and PHP 4.2.2, but I'm sure that it will work on later versions.
I've had the same ridiculous problem with the browser-caching, I've solved it by adding some META TAGS to my overall_header and overall_footer HTML files in my style's template. (Yes, META TAGS in overall_footer too!)
First, I've commented the three header() function calls that you can find in the phpbb file, located at [phpbb directory]/includes/page_header.php, near the end of the file, starting at the line number 449:
header ('Cache-Control: private, pre-check=0, post-check=0, max-age=0');
header ('Expires: ' . gmdate('D, d M Y H:i:s', time()) . ' GMT');
header ('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
Comment them, so they look as follows:
// header ('Cache-Control: private, pre-check=0, post-check=0, max-age=0');
// header ('Expires: ' . gmdate('D, d M Y H:i:s', time()) . ' GMT');
// header ('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
You can also just delete those three lines.
Those lines puts a header in the html connection wich is sent to the user, due to the fact that those headers are included as POST data, they have more priority than conventional META TAGS. (I think is for that reason, not sure)
So, now we don't have any cache-control information with the pages that are sent to our phpbb users. To ensure that the pages will be always reloaded, and not taken from the cache, I've added the conventional META TAGS to my overall_header.tpl file, located in [phpbb directory]/templates/[theme name]/
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="Expires" content="-1">
Remember that those metas have to be inserted inside the head ... /head tags.
Also, I've read somewhere that some versions of IE browsers have a bug in their cache control, and the solution is to put one meta in other head ... /head section, located at the end of the HTML page.
To do this, I've inserted the following lines in the file overall_footer.tpl, located in the same place as the header:
<head>
<meta http-equiv="PRAGMA" content="NO-CACHE">
</head>
Remember to insert those three lines outside the body ... /body tag, but inside the html ... /html tag, si it looks as follows:
------------------
(... whatever HTML your overall_footer.tpl has ...)
</body>
<head;>
<meta http-equiv="PRAGMA" content="NO-CACHE">
</head>
</html>
------------------
It worked fine for me, and without using the "touch" trick.
Hope it works good for you too.
Posted by Enki at
02:55 PM
|
Comments (60)