{"id":131,"date":"2024-01-10T12:54:26","date_gmt":"2024-01-10T12:54:26","guid":{"rendered":"https:\/\/249host.com\/tutorials\/?p=131"},"modified":"2024-01-10T13:40:58","modified_gmt":"2024-01-10T13:40:58","slug":"easy-way-to-enable-php-fpm-for-a-domain","status":"publish","type":"post","link":"https:\/\/249host.com\/tutorials\/easy-way-to-enable-php-fpm-for-a-domain\/","title":{"rendered":"Easy way to enable PHP-FPM directives for a domain."},"content":{"rendered":"<h2 class=\"fittexted_for_content_h4\"><strong>How to enable and customize PHP-FPM directives for a domain or server wide in cPanel<\/strong><\/h2>\n<p>PHP-FPM provides a new experience that addresses many of the shortcomings of traditional PHP handlers such as suPHP, CGI, and DSO. Unlike the traditional methods where the web server tightly couples to processing PHP scripts, PHP-FPM (FastCGI Process Manager) decouples the web server from PHP processing.<\/p>\n<p>In the traditional setup, the web server handles the compiling of PHP scripts through integrated modules like suPHP, CGI, or DSO. These modules execute PHP scripts as part of the web server processes, utilizing the permissions and ownership configurations of those processes. While this approach is stable and mature, it has its limitations.<\/p>\n<p>PHP-FPM introduces a more flexible and efficient model. Instead of running PHP scripts as part of the web server processes, PHP-FPM manages separate pools of PHP processes. These pools are independent of the web server and can operate with their own set of permissions and configurations. This decoupling enhances security and performance, allowing for better resource management and scalability.<\/p>\n<p>By adopting PHP-FPM, web servers can achieve improved responsiveness and handle a larger number of concurrent requests. This approach is particularly beneficial in a high-traffic environment where the traditional PHP handlers might face limitations. Overall, PHP-FPM provides a modern and efficient alternative for running PHP scripts, overcoming the constraints associated with older handlers.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-144 size-full\" src=\"https:\/\/249host.com\/tutorials\/wp-content\/uploads\/2024\/01\/php-fpm.png\" alt=\"php-fpm\" width=\"642\" height=\"390\" srcset=\"https:\/\/249host.com\/tutorials\/wp-content\/uploads\/2024\/01\/php-fpm.png 642w, https:\/\/249host.com\/tutorials\/wp-content\/uploads\/2024\/01\/php-fpm-300x182.png 300w\" sizes=\"auto, (max-width: 642px) 100vw, 642px\" \/><\/p>\n<p><strong>What is PHP-FPM?<\/strong><\/p>\n<p>PHP FastCGI Process Manager (PHP-FPM) is an alternative FastCGI daemon for PHP that makes a website capable of handling strenuous loads. By setting specific amounts of resources, it even allows a host to process a domain\u2019s requests. To accomplish this, the PHP-FPM maintains \u201cpools\u201d (workers available to respond to PHP requests) where these \u201cpools\u201d of workers allow the website to handle more requests than it normally could.<\/p>\n<p>PHP-FPM is faster than traditional CGI-based methods such as SUPHP for multi-user PHP environments. It does not overload a system\u2019s memory with PHP from Apache processes like ruid2+php-dso does. This method is useful when a user receives extra traffic that requires resources to process it. For example, your website may receive a spike in traffic after a TV show features it or is linked from a popular website.<\/p>\n<h3><strong>How to install PHP-FPM?<\/strong><\/h3>\n<p>cPanel supports PHP-FPM directives with the help of EasyApache 4 and Multi-PHP manager. You can check the Multi-PHP manager to see if the PHP-FPM directives is installed or enabled on the server. If the required packages are not enabled, you can directly install them from Multi-PHP manager itself. You may install them using yum too.<\/p>\n<p>&nbsp;<\/p>\n<pre>yum install ea-php54-php-fpm ea-php55-php-fpm ea-php56-php-fpm ea-php70-php-fpm ea-php71-php-fpm ea-apache24-mod_proxy_fcgi<\/pre>\n<p><strong>How to customize Pool values?<\/strong><\/p>\n<p>Once you have installed the necessary package through EasyApache 4, you can enable PHP-FPM to accounts using Multi-PHP manager. However, you will only be able to edit the pool values per domain basis and only a few directives through the Multi-PHP manager. There will be cases where you have a large number of accounts on the server and a default value of directive is very low (Default value for pm.max_children is 5). Then you need to customize the <a href=\"https:\/\/www.squarebrothers.com\/cpanel-hosting-india\/\" target=\"_blank\" rel=\"noopener\">cPanel<\/a> template and use it to generate pool configuration for all the domains.<\/p>\n<p><strong>Set a domain\u2019s pool options<\/strong><\/p>\n<p>Go to Multi-PHP manager and Click \u2018Pool Options\u2019 next to your desired domain. The system will display the available options and their defaults and limits. Enter your desired options for Max Children, Process Idle Timeout (s), and Max Requests. Click Save.<\/p>\n<p><strong>How to customize PHP-FPM values server-wide?<\/strong><\/p>\n<p>The system uses the following configuration files to implement PHP-FPM:<\/p>\n<p><em>\/var\/cpanel\/ApachePHPFPM\/system.yaml :<\/em> This file contains system level settings.<br \/>\n<em>\/var\/cpanel\/ApachePHPFPM\/system_pool_defaults.yaml\u00a0<\/em>: The system uses this file to generate each domain\u2019s pool.<\/p>\n<p>You can use the following as an example.<\/p>\n<p>A complete configuration directive line would resemble the following example:<\/p>\n<p>php_value_open_basedir: { name: \u2018php_value[open_basedir]\u2019, value: \u201c[% documentroot %]\u201d }<\/p>\n<p>Once you have made the changes you will need to run the rebuild command to apply the same to all the domains.<\/p>\n<p>I believe above article will help you to enable php-fpm for a domain in the server.<\/p>\n<p>To secure your website and to know about SSL <a href=\"https:\/\/249host.com\/tutorials\/use-of-sslsecure-socket-layer-certificate\/\">click here.<\/a><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How to enable and customize PHP-FPM directives for a domain or server wide in cPanel PHP-FPM provides a new experience that addresses many of the shortcomings of traditional PHP handlers such as suPHP, CGI, and DSO. Unlike the traditional methods where the web server tightly couples to processing PHP scripts, PHP-FPM (FastCGI Process Manager) decouples [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":144,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,10,1],"tags":[26,25,13],"class_list":["post-131","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-control-panel","category-general","category-linux","tag-cpanel","tag-php-fpm","tag-server"],"_links":{"self":[{"href":"https:\/\/249host.com\/tutorials\/wp-json\/wp\/v2\/posts\/131","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/249host.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/249host.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/249host.com\/tutorials\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/249host.com\/tutorials\/wp-json\/wp\/v2\/comments?post=131"}],"version-history":[{"count":13,"href":"https:\/\/249host.com\/tutorials\/wp-json\/wp\/v2\/posts\/131\/revisions"}],"predecessor-version":[{"id":145,"href":"https:\/\/249host.com\/tutorials\/wp-json\/wp\/v2\/posts\/131\/revisions\/145"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/249host.com\/tutorials\/wp-json\/wp\/v2\/media\/144"}],"wp:attachment":[{"href":"https:\/\/249host.com\/tutorials\/wp-json\/wp\/v2\/media?parent=131"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/249host.com\/tutorials\/wp-json\/wp\/v2\/categories?post=131"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/249host.com\/tutorials\/wp-json\/wp\/v2\/tags?post=131"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}