{"id":8063,"date":"2023-08-08T09:29:02","date_gmt":"2023-08-08T09:29:02","guid":{"rendered":"https:\/\/www.infinitivehost.com\/knowledge-base\/?p=8063"},"modified":"2023-08-22T07:05:58","modified_gmt":"2023-08-22T07:05:58","slug":"how-to-tune-php-fpm-settings-on-cwp-cpanel-and-core-server-having-centos-7-installed","status":"publish","type":"post","link":"https:\/\/www.infinitivehost.com\/knowledge-base\/how-to-tune-php-fpm-settings-on-cwp-cpanel-and-core-server-having-centos-7-installed\/","title":{"rendered":"How to tune php-fpm settings on cwp, cpanel and core server having Centos 7 installed."},"content":{"rendered":"<div class='epvc-post-count'><span class='epvc-eye'><\/span>  <span class=\"epvc-count\"> 3,036<\/span><span class='epvc-label'> Views<\/span><\/div>\n<p>If you&#8217;re running a website on a server with Centos 7 installed, it&#8217;s important to optimize your server&#8217;s performance to ensure your website runs smoothly. One of the ways to do this is by tuning your php-fpm settings. Whether you&#8217;re using cPanel, CWP, or Core Server, optimizing your php-fpm settings can help you achieve better server performance. In this point, we&#8217;ll walk you through the steps to tune php-fpm settings on cPanel, CWP, and Core Server with Centos 7 installed. With our clear and concise instructions, you&#8217;ll be able to optimize your server&#8217;s php-fpm settings in no time.<\/p>\n\n\n\n<p>1. First take backup your current PHP-FPM configuration file:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"567\" height=\"32\" src=\"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/08\/image1-7.png\" alt=\"1. First take backup your current PHP-FPM configuration file:\" class=\"wp-image-8064\" srcset=\"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/08\/image1-7.png 567w, https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/08\/image1-7-300x17.png 300w\" sizes=\"(max-width: 567px) 100vw, 567px\" \/><\/figure>\n\n\n\n<p>2. Edit the PHP-FPM configuration file<\/p>\n\n\n\n<p>Open your PHP-FPM configuration file.You can edit the PHP-FPM configuration file using your preferred text editor. Here, we&#8217;ll use the vi editor:<\/p>\n\n\n\n<p>i. Core server PHP-FPM file location<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"294\" height=\"40\" src=\"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/08\/image2-8.png\" alt=\"i. Core server PHP-FPM file location\" class=\"wp-image-8065\"\/><\/figure>\n\n\n\n<p>ii. cpanel PHP-FPM file location<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"527\" height=\"23\" src=\"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/08\/image3-6.png\" alt=\"ii. cpanel PHP-FPM file location\" class=\"wp-image-8066\" srcset=\"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/08\/image3-6.png 527w, https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/08\/image3-6-300x13.png 300w\" sizes=\"(max-width: 527px) 100vw, 527px\" \/><\/figure>\n\n\n\n<p>iii.&nbsp; Cwp PHP-FPM file location<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"519\" height=\"22\" src=\"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/08\/image4-7.png\" alt=\"iii.\u00a0 Cwp PHP-FPM file location\" class=\"wp-image-8067\" srcset=\"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/08\/image4-7.png 519w, https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/08\/image4-7-300x13.png 300w\" sizes=\"(max-width: 519px) 100vw, 519px\" \/><\/figure>\n\n\n\n<p>To find the PHP-FPM configuration file location, create an info.php file in the document root and run www.yourdomain.com\/info.php in a browser.&nbsp;<\/p>\n\n\n\n<p>3. You can make the following changes to optimize the PHP-FPM settings:<\/p>\n\n\n\n<p><strong>Change the number of child processes:&nbsp;<\/strong><\/p>\n\n\n\n<p>In the [www] section of the configuration file, you can adjust the number of child processes that PHP-FPM spawns to handle incoming requests. The default value is usually 5, but you can increase this value to match the number of CPU cores on your server. For example, if you have 8 CPU cores, you can set the value to:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"435\" height=\"103\" src=\"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/08\/image5-4.png\" alt=\"Change the number of child processes:\u00a0\" class=\"wp-image-8072\" srcset=\"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/08\/image5-4.png 435w, https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/08\/image5-4-300x71.png 300w\" sizes=\"(max-width: 435px) 100vw, 435px\" \/><\/figure>\n\n\n\n<p><strong>Change the process manager:&nbsp;<\/strong><\/p>\n\n\n\n<p>By default, PHP-FPM uses the dynamic process manager, which spawns child processes as needed to handle incoming requests. However, if you have a high-traffic website, you can switch to the ondemand process manager, which only spawns child processes when needed. To switch to the ondemand process manager, set the following values in the [www] section:<\/p>\n\n\n\n<p><strong>Adjust the process priority:<\/strong><\/p>\n\n\n\n<p>You can also adjust the process priority to give more resources to certain child processes. This is useful if you have certain requests that require more resources than others. To adjust the process priority, you can set the following values in the [www] section.<\/p>\n\n\n\n<p>Save and exit the configuration file.<\/p>\n\n\n\n<p>Restart PHP-FPM<\/p>\n\n\n\n<p>To apply the changes, you&#8217;ll need to restart the PHP-FPM service:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"306\" height=\"36\" src=\"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/08\/image6-1.png\" alt=\"Restart PHP-FPM\" class=\"wp-image-8068\" srcset=\"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/08\/image6-1.png 306w, https:\/\/www.infinitivehost.com\/knowledge-base\/wp-content\/uploads\/2023\/08\/image6-1-300x35.png 300w\" sizes=\"(max-width: 306px) 100vw, 306px\" \/><\/figure>\n\n\n\n<p>After restarting the service, PHP-FPM will use the new settings you specified in the configuration file.<\/p>\n\n\n\n<p>It&#8217;s important to monitor the performance of your web server after making these changes, to ensure that the changes are having the desired effect. You can use tools like top, htop or monitoring solutions like Nagios or Zabbix to monitor your server&#8217;s resource usage and performance.<\/p>\n\n\n\n<p>Note: The location of the configuration file may differ according to the panel<\/p>\n","protected":false},"excerpt":{"rendered":"<p>3,036 Views If you&#8217;re running a website on a server with Centos 7 installed, it&#8217;s important to optimize your server&#8217;s performance to ensure your website runs smoothly. One of the ways to do this is by tuning your php-fpm settings. Whether you&#8217;re using cPanel, CWP, or Core Server, optimizing your php-fpm settings can help you [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[61,66,71],"tags":[],"class_list":["post-8063","post","type-post","status-publish","format-standard","hentry","category-cpanel","category-cwp","category-how-tos"],"_links":{"self":[{"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/posts\/8063","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/comments?post=8063"}],"version-history":[{"count":5,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/posts\/8063\/revisions"}],"predecessor-version":[{"id":8074,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/posts\/8063\/revisions\/8074"}],"wp:attachment":[{"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/media?parent=8063"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/categories?post=8063"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/tags?post=8063"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}