Re: RE: how to generate static html pages from dynamic php pages
| From: | Joel Boonstra | Date: | Thu, 09 May 2002 15:18:34 +0000 |
| Subject: | Re: RE: how to generate static html pages from dynamic php pages | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-96818@lists.php.net to get a copy of this message | ||
Rasmus,
I was unaware that PHP could override the status codes sent by Apache.
I knew that PHP could send *additional* status code headers, but I was
under the assumption that the order of operations was:
request -> notfound -> Apache sends 404 header -> 404 page -> PHP sends
more HTTP headers
If the PHP-sent HTTP headers trump the Apache ones, or if I'm just
confused, well, then this is all well and good.
> If you were to have done this using your PATH_INFO approach, you would
> have been hitting the database to generate the data on every single
> request for the same location even though you know that the data will not
> change for 4 hours. On really busy sites this can kill you. And in thie
> case the database was busy enough importing the next batch of weather
> reports that it didn't need these extra hits.
This isn't necessarily true -- I use the exact same method you do. Each
request for a given URL checks for the existance of a
previously-generated file. If the file exists, it simply uses that,
without hitting the database at all. Otherwise, the database is hit
once, and the static page is generated and used.
So, if I begin with a completely empty file cache, only the pages that
receive traffic will be generated, and then only once. My cache is
generated dynamically, based completely on what pages receive hits.
I don't have any schedule setup like you do to remove the
previously-generated files, but if I did, it would work just the same as
your site does.
So, I suppose we're talking about the same things, just with two
different methods. I prefer mine, since I don't have to worry about
sending the right HTTP headers, but that's just me.
Joel
--
[ joel boonstra | jboonstra@gospelcom.net ]