{"id":1768,"date":"2021-07-12T10:37:02","date_gmt":"2021-07-12T05:07:02","guid":{"rendered":"https:\/\/coimbatorewebhosting.com\/blog\/?p=1768"},"modified":"2021-07-17T10:49:14","modified_gmt":"2021-07-17T05:19:14","slug":"enable-customize-php-fpm-directives","status":"publish","type":"post","link":"https:\/\/coimbatorewebhosting.com\/blog\/enable-customize-php-fpm-directives\/","title":{"rendered":"Enable and customize PHP-FPM directives for a domain\/server wide"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/coimbatorewebhosting.com\/blog\/enable-customize-php-fpm-directives\/#How_to_enable_and_customize_PHP-FPM_directives_for_a_domain_or_server_wide_in_cPanel\" >How to enable and customize PHP-FPM directives for a domain or server wide in cPanel<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/coimbatorewebhosting.com\/blog\/enable-customize-php-fpm-directives\/#How_to_install_PHP-FPM\" >How to install PHP-FPM?<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<h2 class=\"fittexted_for_content_h4\"><span class=\"ez-toc-section\" id=\"How_to_enable_and_customize_PHP-FPM_directives_for_a_domain_or_server_wide_in_cPanel\"><\/span><span style=\"text-decoration: underline;\"><strong>How to enable and customize PHP-FPM directives for a domain or server wide in cPanel<\/strong><\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/coimbatorewebhosting.com\/blog\/wp-content\/uploads\/2021\/07\/11.png\" alt=\"PHP-FPM\" class=\"aligncenter size-full wp-image-1788\" width=\"646\" height=\"260\" srcset=\"https:\/\/coimbatorewebhosting.com\/blog\/wp-content\/uploads\/2021\/07\/11.png 646w, https:\/\/coimbatorewebhosting.com\/blog\/wp-content\/uploads\/2021\/07\/11-300x121.png 300w\" sizes=\"auto, (max-width: 646px) 100vw, 646px\" \/><\/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 <a  href=\"https:\/\/coimbatorewebhosting.com\/blog\/top-process-management-commands-in-linux\/\" title=\"workers allow\" alt=\"workers allow\">workers allow<\/a> 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><span class=\"ez-toc-section\" id=\"How_to_install_PHP-FPM\"><\/span><strong>How to install PHP-FPM?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/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 cPanel 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. <a  href=\"https:\/\/coimbatorewebhosting.com\/blog\/how-to-disable-selinux-on-centos\/\" title=\"Enter\" alt=\"Enter\">Enter<\/a> 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 <a  href=\"https:\/\/coimbatorewebhosting.com\/blog\/how-to-install-zabbix-on-centos\/\" title=\"run\" alt=\"run\">run<\/a> the rebuild command to apply the same to all the domains.<\/p>\n<p>Please share your valuable comments to improve better.<\/p>\n<p>For monitoring real time resource usage with <a href=\"https:\/\/www.squarebrothers.com\/linux-web-hosting-india\/\" target=\"_blank\" rel=\"noopener nofollow\">cloud linux(Hosting)<\/a>\u00a0\u2013 LVE , please <a href=\"https:\/\/coimbatorewebhosting.com\/blog\/monitor-esource-usage-in-cloudlinux-lvetop\/\">click here<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>How to enable and customize PHP-FPM directives for a domain or server wide in cPanel What is PHP-FPM? 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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1788,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[153,154,3,1],"tags":[185,184,183],"class_list":["post-1768","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-centos-7-rhel-7","category-cpanel-whm","category-linux","category-latest","tag-directives","tag-fpm","tag-php"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/coimbatorewebhosting.com\/blog\/wp-content\/uploads\/2021\/07\/11.png","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pa2YU7-sw","_links":{"self":[{"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/posts\/1768","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/comments?post=1768"}],"version-history":[{"count":0,"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/posts\/1768\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/media\/1788"}],"wp:attachment":[{"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/media?parent=1768"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/categories?post=1768"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/tags?post=1768"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}