Reply to Re: how to mark php document as cachable (expires only when php file changes)

Your name:

Reply:


Posted by News KF on 11/15/56 11:24

Hi Erwin,

Thanks,

I look at this info.


The reason I'd like to use php is similiar to my example (a for loop
prints out multiple lines of html.

In my real example the php code is much shorter than the created html
and it will be easier to maintain.


Erwin Moller wrote:
>
> Also, I wonder why you use PHP instead of plain HTML, if you do not want to
> change the content.
>
>
> News KF wrote:
>>Hi,
>>
>>
>>I'm new to cahce control, so I hope my question makes sense.
>>
>>
>>let's assume a small php file
>>like
>><html><body>
>><?php
>>$max=10;
>>for($i=0;$i<$max;$i++){
>> print("$i<br>\n");
>>}
>>?>
>></body></html>
>>
>>
>>Obviously the output of this file is predictably constant as it would be
>>for any html file.
>>
>>I assume, that apache would allow a foreign browser to detect, that
>>a html file (creation date or expire) does not have to be reloaded
>>except it has been updated on the server.
>>
>>
>>On the other hand I assume, that php will set the expire attributes for
>>php files per default such, that the request will not be cachable, as
>>php is normally being used for dynamic web pages.
>>
>>However my above php file will always create the same output independent
>>of when and how it will be called.
>>
>>
>>So what exact header would I have to pass to indicate to make the
>>browser understand, that the php file does not have to be refetched,
>>except the php file (its creation date) changed.
>>
>>
>>
>>Thanks in advance for any support.
>>
>>
>>If my request is not clear, then I'll reexplain differently.
>
>
>
> Hi,
>
> Your question is clear.
> However, apache is maybe not the easiest place to start caching
> PHP-documents.
> I think you should tell the browser to cache it.
> But caching can be very confusing, and results may differ from one setup to
> the next (depending on browser, version, proxies, OS, preferences in the
> browser, etc etc.).
> So be sure you try the solution on a few different setups.
>
> But read up here, it contains a lot of headers and some explanations on how
> to use them:
> http://nl2.php.net/header

> Good luck and regards,
> Erwin Moller
>

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация