Forum Moderators: coopster

Message Too Old, No Replies

Best way to cache php scripts

on server side, or on coding? not sure how this works

         

javahava

11:30 am on Jul 1, 2005 (gmt 0)

10+ Year Member



if you have a site that has semi-permanent content (i.e. changes about 2-3 times per year), but would like to minimize mysql usage, i've gathered that php caching is the way to go - is this correct?

and if this is correct, it seems there are several solutions to do this? which is the best? i've come across ioncube - does anyone have recomendations or words of warning? is this something i just ask our host to install and presto, our pages are cached?

Blackie

1:07 pm on Jul 1, 2005 (gmt 0)

10+ Year Member



I would actually run a crond jobs to make static .html files.

Just my .02$

mincklerstraat

2:00 pm on Jul 1, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I tried jpcache for one site and was quite happy with it - you just 'drop it in' - two lines at the top of each of your php pages, or you could auto-prepend it with an .htaccess file. Real easy to use, and it also does E-Tag and Last-Modified / If-Modified-Since headers, so proxies and peoples' ISP's can cache the pages. If you add expires headers for three months in the future, a very good chance that many people see your pages without a single hit coming to your server. I believe I had to modify jpcache for my needs (including adding , but you might not need to.

One of the best cache tutorials is at sitepoint, google sitepoint php cache. It covers some of PEAR's packages, which would also be a great answer, albeit would require a little bit more work than jpcache.

lobo235

5:26 pm on Jul 1, 2005 (gmt 0)

10+ Year Member



You could also use Smarty to do the caching although it is a template engine for PHP so it might do too much for your needs.

[smarty.php.net...]

SeanW

6:35 pm on Jul 2, 2005 (gmt 0)

10+ Year Member



With PHP there are two types of caching... Opcode caching, where the php is compiled once and repeatedly executed, and page caching, where the output is cached. If you're using a template engine like Smarty, there is also template caching (and as another poster mentioned, it also does page caching).

Opcode caching can be done with a plugin, like Zend or turck-mmcache. I've used the latter with amazing results.

Ultimately it's decided by what your application needs.

Sean