ããíÒÇÊ / ÝÇÆÏÉ php fpm pool ãæÇÞÚ ÇÓÑÚ | ÍãÇíÉ ÇÚáí | áæÏ ÇÞá advantages
advantages to increases website speed - How Fast is WordPress with PHP-FPM 7
What is PHP-FPM and what are the benefits?
PHP-FPM: The Future of PHP Handling
åäÇß ÃæÞÇÊ íßæä ÝíåÇ ÚÏÏ ÇáÒíÇÑÇÊ ßÈíÑðÇ Úáì ãæÞÚ ÇáæíÈ ÇáãÍÏÏ ¡ æÍíË ÞÏ íÊÚÐÑ Úáì ãÚÇáÌÇÊ PHP ãËá mod_PHP ãÚÇáÌÉ ØáÈÇÊ ÇáãÓÊÎÏãíä ÈßÝÇÁÉ. åäÇ ¡ 쾄 PHP-FastCGI Process Manager (PHP-FPM) ÃÓÇÓí. Åäå ãÚÇáÌ ãÊÞÏã æÝÚÇá ááÛÇíÉ. Ýí ÇáæÇÞÚ ¡ PHP FPM ÃßËÑ ÝÚÇáíÉ ÈÜ 350 ãÑÉ ãä ãÚÇáÌÇÊ PHP ÇáÃÎÑì áÃäå íÓÊÎÏã äåÌðÇ ÍÏíËðÇ ãæÌåðÇ äÍæ ÇáÚãáíÉ.
äÍÕá ÚÇÏÉð Úáì ØáÈÇÊ ãä ÚãáÇÆäÇ áÒíÇÏÉ ÓÑÚÉ ÇáãæÞÚ ÈÇÓÊÎÏÇã PHP FPM ßÌÒÁ ãä ÎÏãÇÊ ÅÏÇÑÉ ÇáÎÇÏã ÇáÎÇÕÉ ÈäÇ. Çáíæã ¡ ÓäÑì ßíÝ íäÇÞÔ ãåäÏÓæ ÇáÏÚã áÏíäÇ ÝæÇÆÏ PHP FPM æßíÝ íÚÒÒæä ÃÏÇÁ ÇáãæÞÚ. áãÇÐÇ PHP FPM, ÏÚæäÇ ÃæáÇð äáÞí äÙÑÉ ÓÑíÚÉ Úáì ãíÒÇÊ PHP FPM.
PHP FPM (ãÏíÑ ÚãáíÇÊ FastCGI) åæ ÈÏíá áÊäÝíÐ PHP ÇáÊÞáíÏí.
Ýí ÇáÃÓÇÓ ¡ ÝÅäå íÚÊãÏ Úáì ãÝåæã ÅÏÇÑÉ ÊÌãÚ. ßá ãÌãæÚÉ ãä ãÌãæÚÇÊ PHP-FPM ÊÚãá ßäÓÎÉ ßÇãáÉ ãä PHP ¡ áåÇ Êßæíä æÍÏæÏ æÞíæÏ ÎÇÕÉ ÈåÇ. ÊÞÏã ãÌãæÚÉ ÚãáíÇÊ PHP ¡ æÇáÊí ÊÓãì ÃíÖðÇ ÇáÚãÇá workers ¡ ØáÈÇÊ áÊäÝíÐ ãáÝÇÊ PHP ãä ãáÝÇÊ ÇáæíÈ. ãÑÉ ÃÎÑì ¡ íãßä ÊÔÛíá FPM ÊÌãÚÇÊ ãäÝÕáÉ ãÊÚÏÏÉ ¡ ßá ãäåÇ áå åæíÊå ÇáÎÇÕÉ. ÈÔßá ÇÝÊÑÇÖí ¡ íÞæã mod_PHP ÈÅÛáÇÞ ÇáÚãáíÇÊ æÊÚØíá ÃÏÇÁ ãæÞÚ ÇáæíÈ. åÐÇ åæ ÇáÚíÈ ÇáÑÆíÓí áãæÇÞÚ PHP ÇáÊÞáíÏíÉ. æáßä ¡ íãßä PHP FPM ÈÓåæáÉ ÇáÊÛáÈ Úáì åÐå ÇáãÔßáÉ.
ÝæÇÆÏ PHP FPM
åäÇ ¡ äáÞí äÙÑÉ Úáì ÝæÇÆÏ PHP FPM æßíÝ íÓÇÚÏ Ðáß Ýí ÊÍÓíä ÃÏÇÁ ÇáãæÞÚ.
ÈÚÖ ÇáÝæÇÆÏ ÇáÊí íÑÇåÇ ãåäÏÓæ ÇáÏÚã áÏíäÇ Ýí PHP FPM ãÏÑÌÉ ÃÏäÇå.
1. ØÑíÞÉ ÌÏíÏÉ áãÚÇáÌÉ ÇáÚãáíÉ new way of process handling
íæÝÑ PHP-FPM ØÑíÞÉ ÌÏíÏÉ áãÚÇáÌÉ ÇáØáÈÇÊ. íÝÚá Ðáß Úä ØÑíÞ ÇáÍÝÇÙ Úáì ÍãÇãÇÊ ÇáÓÈÇÍÉ pools ¡ íÓãì ÇíÖÇ ÇáÚãÇá
workers ¡ ÇáÊí íãßäåÇ ÇáÇÓÊÌÇÈÉ áØáÈÇÊ PHP. ÚäÏãÇ íßæä áÏì ÎÇÏã ÇáæíÈ ØáÈ ¡ íÞæã ÇÊÕÇá FastCGI ÈÅÚÇÏÉ ÊæÌíåå Åáì ÎÏãÉ PHP-FPM. íÞæã PHP-FPM ÈÚÏ Ðáß ÈÊÌãíÚ æÊäÝíÐ ÈÑäÇãÌ PHP ÇáÓÑßÈÊ ¡ æÅÑÓÇá ÇáÅÎÑÇÌ ãÑÉ ÃÎÑì Åáì ÎÇÏã ÇáæíÈ æíäÊÙÑ ÇáØáÈÇÊ ÇáÌÏíÏÉ. áÐáß ¡ ÊÓãÍ ãÚÇáÌÉ ÇáÓÑßÈÊ áÜ PHP ÈåÐå ÇáØÑíÞÉ ÈÃÏÇÁ ãÚÇáÌÉ ÃÚáì ÈßËíÑ. Ýí ÇáæÇÞÚ ¡ ÝÅäå íÚÌá æíÓÑÚ ÊÍãíá ÇáãæÞÚ.
2. ÔÝÑÉ ÇáÊÔÛíá ÇáÊÎÒíä ÇáãÄÞÊ Opcode caching
PHP FPM áÏíå ÃíÖðÇ ÇáÞÏÑÉ Úáì ÇÓÊÎÏÇã ÊÎÒíä ÔÝÑÉ ÇáÊÔÛíá ÇáãÄÞÊ ááÈÑÇãÌ ÇáäÕíÉ áÜ PHP. íãßä Ãä ÊÎÏã ÍÑßÉ ãÑæÑ ÃÚáì Úä ØÑíÞ Êãßíä ÇáÊÎÒíä ÇáãÄÞÊ caching ÔÝÑÉ ÇáÊÔÛíá. ÚäÏãÇ íÊã ÊÞÏíã ØáÈ ÓßÑÈÊ PHP ¡ íÊÍÞÞ PHP-FPM ÈÓÑÚÉ ãä ÇáäÓÎ ÇáãÎÒäÉ ãÄÞÊðÇ æíÚÇáÌ ÇáØáÈ.åÐå ÇáØÑíÞÉ ÊæÝÑ ÇáæÞÊ æÊÍÓä ßÝÇÁÉ ÇáãæÇÑÏ.
3. áÇ ÊÝÑØ Ýì ÇááæÏ Do not overload
PHP-FPM ÃÓÑÚ ãä ÇáÃÓÇáíÈ ÇáÊÞáíÏíÉ ÇáÞÇÆãÉ Úáì CGI ¡ ãËá SUPHP ¡ Ýí ÈíÆÇÊ PHP ãÊÚÏÏÉ ÇáãÓÊÎÏãíä. áÇ íÄÏí Åáì ÒíÇÏÉ ÊÍãíá ÐÇßÑÉ äÙÇã ãÚ PHP ãä ÚãáíÇÊ Apache ãËá ruid2 + php-dso. åÐå ÇáØÑíÞÉ ãÝíÏÉ ÚäÏãÇ íÊáÞì ÇáãÓÊÎÏã ÍÑßÉ ãÑæÑ ÅÖÇÝíÉ overload ÊÊØáÈ ãæÇÑÏ áãÚÇáÌÊåÇ. åÐå ÇáãíÒÉ åí äÚãÉ ÚäÏãÇ íÊáÞì ãæÞÚ ÇáæíÈ ÇáÎÇÕ Èß ÒíÇÏÉ Ýí ÍÑßÉ ÇáãÑæÑ extra traffic ÈÚÏ ÍãáÉ ÊÓæíÞíÉ ãÚíäÉ. ÊÐßÑ Ãä ÇáãæÇÞÚ ÇáÔÇÆÚÉ ÊÓÊÝíÏ ãä åÐå ÇáãíÒÉ ÎáÇá Ãí ãä ÇáãäÇÓÈÇÊ ÇáÎÇÕÉ ÈåÇ.
4. Ããä / ÍãÇíÉ ÅÖÇÝíÉ Additional security
æÈÇáãËá ¡ íæÝÑ PHP-FPM ÃãÇäðÇ ÅÖÇÝíðÇ. áÊÍÞíÞ Ðáß ¡ íÌÈ Ãä íÍÊæí ãáÝ ÊåíÆÉ PHP ÇáÑÆíÓí ááÎÇÏã Úáì ÇáÞíã ÇáÊÇáíÉ ãÖÈæØÉ Úáì true:
ßæÏ:
opcache.validate_root = true
opcache.validate_permission = true
ÊæÝÑ åÐå ÇáÅÚÏÇÏÇÊ ØÈÞÉ ÅÖÇÝíÉ ãä ÇáÞíæÏ ÇáÊí íãßä Ãä ÊãäÚ ÇáãÓÊÎÏãíä ãä ÇáæÕæá Åáì ÐÇßÑÉ ÇáÊÎÒíä ÇáãÄÞÊ áÔÝÑÇÊ opcode caches ÇáãÓÊÎÏãíä ÇáÂÎÑíä. ÊäØÈÞ åÐå ÇáãÎÇæÝ Ýí ÇáãÞÇã ÇáÃæá Úáì ÈíÆÇÊ ÇÓÊÖÇÝÉ ãÊÚÏÏÉ ÇáãÓÊÃÌÑíä Êã ÊßæíäåÇ áÊæÝíÑ ãäÕÉ ÂãäÉ ãÚ PHP-FPM.
5. ÇÞÕì ÊÍßã Ýì ÇáÇÚÏÇÏÇÊ ááÛÇíÉ Highly configurable
ÚáÇæÉ Úáì Ðáß ¡ íæÝÑ PHP-FPM ÎíÇÑÇÊ Êßæíä ÃßËÑ ãä ãÚÇáÌÇÊ PHP ÇáÃÎÑì. íãßä ÖÈØ ÎíÇÑÇÊ ÇáÊßæíä åÐå áßá ãæÞÚ Úáì ÇáÎÇÏã. íæÝÑ ÇáÊßæíä ÇáÕÍíÍ áÜ PHP-FPM ÃÝÖá ÃÏÇÁ áÒæÇÑ ÇáãæÞÚ ¡ ßãÇ íÖãä ÈíÆÉ ÂãäÉ æãÃãæäÉ. Úáì ÓÈíá ÇáãËÇá ¡ íãßääÇ ÖÈØ ÅÚÏÇÏÇÊ PHP-FPM Ýí æÇÌåÉ ÅÏÇÑÉ MultiPHP ãä WHM ÈÇáÇäÊÞÇá Åáì WHM> ÇáÕÝÍÉ ÇáÑÆíÓíÉ> ÇáÈÑãÌíÇÊ> MultiPHP Manager. åßÐÇ ÊÈÏæ.
Here’s an example of PHP FPM status on one of the servers that we manage:
ßæÏ:
[root@xx ~]# service ea-php70-php-fpm.service status
Redirecting to /bin/systemctl status ea-php70-php-fpm.service
â—� ea-php70-php-fpm.service - The PHP FastCGI Process Manager
Loaded: loaded (/usr/lib/systemd/system/ea-php70-php-fpm.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2019-01-09 13:59:50 xxx; 2h 40min ago
Main PID: 203156 (php-fpm)
Status: "Processes active: 0, idle: 0, Requests: 16, slow: 0, Traffic: 0req/sec"
CGroup: /system.slice/ea-php70-php-fpm.service
└─203156 php-fpm: master process (/opt/cpanel/ea-php70/root/etc/php-fpm.conf)
--------------------------------------
How to Use PHP-FPM with cPanel PHP performance is an enduring issue for web hosts. PHP is the most widely used server programming language on the web by a big margin. The most popular content management systems and ecommerce applications are written in PHP, including WordPress®, Joomla, Drupal, Magento®, and dozens more.
The ultra-fast PHP-FPM accelerates PHP execution on busy web servers, making it a valuable tool in the fight against slow sites and resource-constrained servers.
This article takes a deep dive into how PHP-FPM works and explains how to deploy and configure it with cPanel & WHM.
What is PHP-FPM? PHP-FPM is an alternative PHP implementation that makes busy web applications faster while helping system administrators to control resource consumption on their server.
A PHP implementation, also known as the runtime, interprets and executes code. Traditional runtimes such as Apache’s mod_PHP do their work within the web server. That approach has advantages, but each connection consumes a chunk of the server’s resources for as long as it lasts. If there are too many concurrent connections, the server may run out of resources like memory altogether, impacting the performance of every site it hosts.
PHP-FPM does things differently: it operates outside of the web server and uses a pool of worker processes to execute code. The workers are ready and waiting when a request comes in, and you can control how many workers are in the pool so they can’t multiply until they consume all the server’s RAM and processor time.
It works like this:
- Apache sends code to PHP-FPM over a high-speed binary interface called FastCGI.
- A supervisor process chooses a worker process from the pool and gives it the code.
- The worker executes the code, and the result is sent back to Apache, which sends it to the web browser.
- Once the worker is done, it returns to the pool to await another chunk of code to execute.
If there are too many concurrent connections, some might have to wait for a free worker, but they will never consume all of the server’s resources. On a busy web server, worker pools are faster and more efficient than other strategies.
Getting Started with PHP-FPM in CentOS and EasyApache It is straightforward to activate and configure PHP-FPM in cPanel & WHM. You can choose which domains use it and set configuration variables that influence its behavior.
The first step is to turn it on in the
System PHP-FPM settings in WHM’s
MutliPHP Manager.

When you click
Turn On, WHM makes PHP-FPM available, but it doesn’t activate it for all domains automatically. You can force all accounts on the server to use PHP-FPM by clicking
Convert All Accounts to PHP-FPM.

Alternatively, you can activate PHP-FPM for individual domains in the table at the bottom of this page. To turn it on for several domains at once, select them in the table and choose
On in the drop-down menu.
Configuring PHP-FPM in cPanel Once you have activated PHP-FPM, you can configure both the system defaults and the settings for individual domains in
MultiPHP Manager.
Click the
System PHP-FPM Configuration tab.

In this section, there are three pool settings you can change. These are the default values that are applied to domain pools.
- Max Requests: The number of requests each worker process should execute before it restarts itself. This setting is useful for working around memory leaks. The default of 20 is acceptable for most web hosting scenarios, but you may want to increase it to between 40 and 60 on servers with heavy traffic.
- Process Idle Timeout: How long an idle worker process will wait before shutting down. Idle processes consume resources, so we don’t want too many hanging around, but we don’t want to kill them too soon because it takes a while to start new ones. The default of 10 (seconds) may be too low for a busy server.
- Max Children: The maximum number of worker processes in each pool. The default is 5.
Many factors affect the optimal values for these settings, including the code your server runs and the amount of RAM it has. We wrote
PHP-FPM Performance Tuning Basicsto help you decide on the correct values for your server.

Underneath the pool options are PHP INI directives. We surface several of the most useful in the interface, and you can find more information about them in PHP’s
Runtime Configuration documentation. We’ll show you how to add other directives in the next section.
In addition to system-wide configuration, you can also configure individual domains in the WHM interface.

In the table at the bottom of
MutliPHP Manager, click
Edit PHP-FPM at the end of the domain’s row. The options that appear are identical to those in the system-wide configuration interface.
How the cPanel PHP-FPM Module Works
Although the WHM interface contains the most useful configuration options, there are many more in the
documentation. To add or modify them, you will need to edit configuration files on the
server’s command line or in the cPanel & WHM
File Manager.
The two most important system-wide configuration files are:
- /var/cpanel/ApachePHPFPM/system.yaml
- /var/cpanel/ApachePHPFPM/system_pool_defaults.yaml
WHM doesn’t create these files because the system doesn’t need them, but you can create them yourself and add directives to override the defaults.
touch /var/cpanel/ApachePHPFPM/system.yaml
touch /var/cpanel/ApachePHPFPM/system_pool_defaults.yaml You may also have to create the directory with:
mkdir -p /var/cpanel/ApachePHPFPM/ In these files, enter only directives that differ from and override the system directives. For example, if you wanted to change the
emergency_restart_threshold directive from the default of 0, the
system_pool_defaults.yaml file would look like this:

The three dashes at the top of the file (———) are part of the YAML markup language and must be present. The configuration file won’t work without them.
In the PHP documentation, you will find directives formatted with periods (.) and other symbols;
syslog.facility,for example. When adding directives to configuration files, these symbols must be replaced with an underscore (_). For example, instead of
syslog.facility, use
syslog_facility.
You can learn more about configuring the cPanel PHP-FPM module in
Configuration Values of PHP-FPM and
PHP-FPM Code and FileSystem Layout for EasyApache 4.
Creating User Pools in PHP-FPM Finally, we’ll look at manually creating and configuring domain-specific user pools in PHP-FPM. These are the worker pools used by sites hosted on your server’s domains.
The PHP-FPM module creates a worker pool for a domain if it finds a configuration file in:
/var/cpanel/userdata/[user]/[domain].php_fpm.yaml Replace [user] and [domain] with the relevant values for your server. You can create this file or activate PHP-FPM for a domain in WHM and it will be created automatically.

At a minimum, the file
must contain the following information:
As with the system files, you can add directives to configure the user pools. After creating or editing the .yaml file, run the following command:
/scripts/php_fpm_config – rebuild
The script adds directives to Apache’s config file and restarts PHP-FPM, after which the new pool will be up and running. You can find more information about creating user pools in
PHP-FPM User Pools.
Easy PHP-FPM Configuration with cPanel & WHM PHP-FPM gives busy web servers a huge performance boost. Just as important, it helps web hosts to make the most of limited server resources, reducing the cost of providing an excellent hosting experience to clients and their users.
With cPanel & WHM, PHP-FPM can be activated in seconds and configured in an intuitive interface. If you need to dig deeper into PHP directives, our module makes building custom configurations for the runtime and worker pools straightforward.
ÇáÎáÇÕÉ :
PHP-FPM is an
efficient method on how to minimize the memory consumption and rise the performance for the websites with heavy traffic. It is significantly faster than traditional CGI-based methods in multi-user PHP environments.
ÇÏÇÁ ÇÚáì æÇÓÊåáÇß ÑÇã ÇÞá æáßä ÞÏ íÊØáÈ ÇáÛÇÆåÇ ÇÐÇ ßÇä áÏíß ÊØÈíÞ íÍÊÇÌ ÑÇã ÚÇáì.
ÇáãÝÖáÇÊ