Quick answer: Run PHP 8.3 with OPcache on, size the FPM pool from your RAM (pm.max_children ≈ available RAM ÷ ~60–80 MB per worker), set memory_limit = 256M, and raise upload limits to something practical (64M). PHP-FPM sizing is the difference between a stable site and 502s under load.

Overview

Every uncached WordPress request is a PHP request, so PHP configuration directly sets your capacity ceiling. Two knobs dominate: OPcache (removes recompilation cost — nearly free speed) and the FPM process manager (how many requests you can serve in parallel before queuing).

Before you start

  • Know your worker footprint: run some traffic, then check with
    ps --no-headers -o rss -C php-fpm8.3 | awk '{sum+=$1; n++} END {print sum/n/1024 " MB avg"}'
  • Know your free RAM after MariaDB/Redis/web server: free -h.

Step-by-step guide

  1. Edit the pool (/etc/php/8.3/fpm/pool.d/www.conf) — example for ~2 GB free RAM and ~70 MB workers:
    pm = dynamic
    pm.max_children = 25
    pm.start_servers = 5
    pm.min_spare_servers = 3
    pm.max_spare_servers = 8
    pm.max_requests = 500
  2. Tune /etc/php/8.3/fpm/php.ini:
    memory_limit = 256M
    upload_max_filesize = 64M
    post_max_size = 64M
    max_execution_time = 120
  3. Confirm OPcache and give it room (php.ini, usually already enabled):
    opcache.enable=1
    opcache.memory_consumption=192
    opcache.max_accelerated_files=20000
    opcache.validate_timestamps=1
  4. Apply and verify: sudo systemctl reload php8.3-fpm, then watch for “server reached pm.max_children” warnings in /var/log/php8.3-fpm.log — that message means the pool is too small (or the requests too slow).

Common issues

  • 502/504 under load: pool exhausted — raise pm.max_children only if RAM allows, otherwise make requests cheaper (caching) or upgrade RAM.
  • max_children set by RAM you don’t have: workers × footprint must fit in free RAM, or the OOM killer visits MariaDB first.
  • memory_limit confusion: it’s per-request, not total — 256M does not mean every request uses 256 MB.

When to contact support

If tuned FPM + caching still hits the ceiling, the workload has outgrown the plan — open a ticket to discuss an upgrade to more vCPU/RAM (Power VPS for CPU-heavy dynamic sites).

Frequently asked questions

How do I calculate pm.max_children for PHP-FPM?

Divide the RAM you can spare for PHP by one worker's average footprint (typically 60-80 MB for WordPress): 2 GB free / 70 MB is roughly 25-28 workers — leave headroom for the database.

Does upgrading PHP versions really make WordPress faster?

Yes — PHP 8.x benchmarks meaningfully faster than 7.4 on WordPress workloads and receives security patches; test plugins on staging, then upgrade with the ondrej PPA or your panel.

What does pm.max_requests do?

It recycles each FPM worker after N requests (e.g. 500), which papers over slow memory leaks in plugins and keeps long-running pools from bloating over days.

Related articles

Ready to get started? Order a WordPress VPS at Cloud2Y →

Was this answer helpful? 0 Users Found This Useful (0 Votes)