PHP Caching

software development

#1

I have a dynamic, PHP and MySQL based site. The pages often load slower than I would like. Someone suggested that caching might help. Any suggestions?

Editor of http://www.ExploreDance.com


#2

It most certainly should. There are a few different ways to accomplish caching of your pages though. What did you have in mind?

you could just have PHP kick the pages out to static files, and have the files be automatically regenerated a few times a day, and on special events like posts etc.

Any kind of caching will make the pages load faster, but will also make them a bit less dynamic.

Another simple thing I would suggest is running optimize table on each of the tables being used to build your pages.

http://dev.mysql.com/doc/refman/5.0/en/optimize-table.html

This is essentially like defragging a hard drive, so you don’t need to do it very often, but I’ve seen it give a healthy performance boost on large databases.