← All posts

Optimizing PHP for speed

By Mukesh Tandi · Performance

PHP is fast enough for almost any site — if you configure it properly. Most "slow WordPress" problems aren't PHP's fault; they're missing caches and lazy defaults. Here's what actually moves the needle.

1. Turn on and tune OPcache

OPcache stores compiled PHP in memory so it isn't re-parsed on every request. Give it enough memory (128–256MB), raise max_accelerated_files, and on production set validate_timestamps=0 so it doesn't stat files constantly.

2. Use a persistent object cache

Redis or Memcached lets WordPress reuse expensive query results across requests. On a busy site this alone can cut database load dramatically and drop response times.

3. Cache full pages where you can

For anonymous visitors, serve a cached HTML page instead of booting PHP at all. LiteSpeed Cache or a reverse proxy handles this and keeps TTFB low under load.

4. Use a modern PHP version

Each recent PHP release is measurably faster than the last. Staying current is one of the easiest free speed upgrades you can make.

Want your site tuned? Let's talk →