Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What is a recommended strategy from caching PHP dynamic pages? I have tried a couple of suggestions from serverfault, but they all include code changes. I was wondering if someone has been able to get this to work? (php dynamic page caching) And I see this has been asked many times over. But is there actually one that works?

share|improve this question

closed as not constructive by Michael Hampton, Magellan, John Gardeniers, Ward, MadHatter Nov 20 '12 at 7:27

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

up vote 3 down vote accepted

Try a reverse proxy like Varnish.

I still doubt that you're going to get away with zero code changes, though.

share|improve this answer

To cache the entire page nginx and/or varnish should do the trick.

To cache PHP code, then look into using APC or similar.

Anything else and you will definitely have to make some code changes.

share|improve this answer

If your dynamic pages are actually the same no matter who the end user might be, then putting something like Varnish on port 80 caching requests from Apache on port 8080, is probably the simplest way to do this and does not require any code changes.

If your dynamic pages are different for different users, then you will definitely need to perform some code changes, unless the application already sets cache/do-not-cache headers which you can tell Varnish to respect.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.