Bobcares

PHP-FPM Domain Pools

by | Mar 19, 2022

Wondering how to create PHP-FPM Domain Pools? We can help you.

As part of our Server Management Services, we assist our customers with similar queries.

Today, let us see how our Support techs resolve this.

How to create PHP-FPM Domain Pools?

Usually, the system creates a pool when the /var/cpanel/userdata/[user]/[domain].php_fpm.yaml configuration file exists in the domain.

This file must include the following lines:

1
2

---
_is_present: 1

You may place any desired pool values in this file.

You must include the — line above the pool values in this file.
The _is_present value is optional, but you must include it if you do not set any other values in the file.

Warning:

Exercise extreme caution when you manually edit .yaml files.

Incorrect syntax in these files will cause services to fail.

We strongly recommend that you create a backup of your system before you manually edit .yaml files.

Please note this file only contains the differences of directives from the built-in default directives.

Today let us see the steps followed by our Support techs to create a pool, run the Cpanel::PHPFPM::rebuild_files() function.

Please note, you may also run the /scripts/php_fpm_config –rebuild script to create a pool.

 
The system will perform the following steps:

1. Firstly, the system scans for the /var/cpanel/ApachePHPFPM/system.yaml and /var/cpanel/ApachePHPFPM/system_pool_defaults.yaml files and then generates a system configuration for each of the PHP versions.
2. Then, the system searches for the domain’s yaml files.
3. The system generates a line in the /opt/cpanel/[ea_php_version]/root/etc/php-fpm.d/[domain].conf file for every domain.yaml file.
4. Finally, to direct the requests to the php_fpm daemon with Apache, the system modifies the httpd.conf file with the rebuild_files() script to resemble the following example:


1 # php -- BEGIN cPanel-generated handler, do not edit
2 <FilesMatch ".(phtml|php[0-9]*)$">
3 SetHandler "proxy:unix:/home/cptest3/cptest3_tld.php_fpm.sock|fcgi://cptest3.tld/"
4 </FilesMatch>
5 # php -- END cPanel-generated handler, do not edit

Jail shell

When you create a PHP-FPM domain pool, if the following conditions exist, the system automatically binds them to the virtfs mount:

  • The /var/cpanel/feature_toggles/apachefpmjail file exists.
  • The WHM account uses either the jailshell or noshell settings.
  • You enabled the _Experimental: Jail Apache Virtual Hosts using modruid2 and cPanel® jailshell setting in the Security section of WHM’s Tweak Settings interface (WHM >> Home >> Server Configuration >> Tweak Settings).

[Stuck in between? We are glad to assist you]

Conclusion

In short, today we saw steps followed by our Support Techs to create PHP-FPM Domain Pools.

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.