Tricks, tips, tutorials, pictures and words


For most PHP applications – in fact, for most web applications of any kind – there's no catch. Granted, a naive PHP script like the one in Illustration 1 will trigger database activity with every page view, but if we're talking about a few views each hour (or even each minute) , who cares? Still, a very small number of PHP applications will get lucky enough that their performance does start to matter. Once a site gets up to multiple hits each second, opening a new database connection with each page view becomes a huge problem; even with a connection pool, executing four or five queries to construct each page will generate a lot of activity, and that's especially serious when you consider the fact that most PHP applications run on shared servers, where other applications are competing for resources.