Skip to content

Per-account PHP-FPM pools versus a shared pool on cPanel

The trade-off between cPanel's default per-account PHP-FPM pool model and a shared-pool setup, when each is appropriate, and the memory and isolation implications of consolidating.

cPanel’s default when you enable PHP-FPM is one pool per account: a hundred accounts get a hundred pool definitions. The alternative is a smaller number of shared pools that several accounts use. The default is the right choice in most cases — pool-per-account is the isolation boundary that makes shared hosting actually shared rather than gambled. The shared-pool model has a niche, but knowing which side you are on matters.

What’s happening

A per-account PHP-FPM pool has its own pm.max_children, request_slowlog_timeout, php_admin_value for the account, runs as the account user via the pool’s user and group directives, and listens on its own socket at /opt/cpanel/ea-php<ver>/root/usr/var/run/php-fpm/<user>.sock. Apache’s per-vhost ProxyPass points at that socket. With a shared pool, multiple accounts proxy to the same socket; the pool runs as one specified user, which means all accounts using the pool share file ownership semantics — losing per-account isolation.

How to verify

Inventory the current pool layout:

ls /opt/cpanel/ea-php82/root/etc/php-fpm.d/ | head
grep -l "^user = " /opt/cpanel/ea-php82/root/etc/php-fpm.d/*.conf | wc -l
whmapi1 php_get_vhost_versions | head
ps -C php-fpm -o user | sort -u

If there is one .conf file per account in the pool directory and ps shows many distinct users running php-fpm, you are on per-account pools — the default.

The fix

The decision criteria:

  1. Stay on per-account pools (the default) if: more than ten accounts on the host, customers are independent, isolation matters for compliance or trust, per-account tuning (different memory_limit per account) is required.
  2. Consider a shared pool if: all accounts on the host belong to one customer (single-tenant box with multiple domains), per-account memory budget is wasteful because most pools sit idle, or you have a specific reason to consolidate.
  3. To consolidate, configure a single pool in /opt/cpanel/ea-php82/root/etc/php-fpm.d/shared.conf running as one user, then in each vhost’s Pre VirtualHost Include set the <FilesMatch \.php$> block to proxy to the shared pool’s socket. This bypasses cPanel’s per-account pool generation.
  4. The shared-pool approach is unusual; cPanel does not officially document or support it. You take on the burden of regenerating the include when accounts are added or removed.
  5. For most shared-hosting scenarios, the answer is to stay on per-account pools and tune them tightly. A pool that sits idle costs nothing under pm = ondemand; only pm = dynamic with too-high pm.start_servers consumes memory at rest.
  6. Document which model you are on. The next operator who counts FPM processes and panics because there are 60 of them on a 60-account host should be able to look up “yes, per-account, by design.”

For environments where the choice between models is part of architecture, Stack Harbor maps the pool layout against tenancy requirements under cPanel/WHM management.