"Caching" a php script

Hello,

In javascript, CSS, the browser can cache files so that there are fewer trips to the browser. Might there be something analogous in PHP? In particular, to keep organized, I have every function that I need for my site in one script. Each script only calls a few functions and it seems a bit of a waste of resources to read through the entire script each time. So, is it possible to either:

  1. Create “Session Functions” that can be defined once and then used while a user is logged in
  2. Somehow Cache the functions

If neither works, then I can definitely break the functions script into smaller pieces, but I’d much prefer to leave things as is if possible.

Thank you,

Eric

It sounds like you’re looking for a PHP Accelerator. There’s quite a few of those out there. The most popular ones are APC and XCache AFAIK.

There’s an explanation of PHP Accelerators with a nice list over at wikipedia, here List of PHP accelerators - Wikipedia, the free encyclopedia

Exactly what I’m looking for! Thanks so much…

-Eric

APC becomes part of PHP core as of 5.4, so unless you specifically need a function out of one of the other accelerators I would recommend learning and using it.

Thank you for the extra info…

-Eric