{"id":12510,"date":"2024-06-03T13:24:16","date_gmt":"2024-06-03T07:54:16","guid":{"rendered":"https:\/\/www.skynats.com\/?p=12510"},"modified":"2025-10-28T11:22:48","modified_gmt":"2025-10-28T05:52:48","slug":"manage-php-ini-directives-php-fpm-cpanel","status":"publish","type":"post","link":"https:\/\/www.skynats.com\/blog\/manage-php-ini-directives-php-fpm-cpanel\/","title":{"rendered":"How to Manage PHP.ini Directives with PHP FPM on a cPanel Server"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/www.skynats.com\/server-management\/\">Manage PHP.ini Directives with PHP FPM<\/a> on cpanel can be useful for altering PHP configurations to specific application requirements. When using PHP-FPM alongside cPanel, the process becomes more streamlined and efficient.PHP-FPM (FastCGI Process Manager) significantly elevates PHP performance and provides more granular control over PHP settings. This blog post will take you through the steps for managing php.ini directives on a cPanel server using PHP-FPM.<\/p>\n\n\n\n<h2 class=\"wp-block-heading has-normal-font-size\" id=\"h-prerequisites\">Prerequisites<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>A cPanel account with root access.<\/li>\n\n\n\n<li>PHP-FPM enabled on your server.<\/li>\n\n\n\n<li>Basic knowledge of how to use the cPanel interface<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading has-normal-font-size\" id=\"h-1-enabling-php-fpm-in-cpanel\"><strong>1. Enabling PHP-FPM in cPanel<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Before managing php.ini directives, ensure PHP-FPM is enabled for your domain:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">i. For this, First Log in to WHM&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">ii. Then, Navigate to MultiPHP Manager and select User Domain settings.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">iii. In the domain section, Select your domain and check whether &#8220;PHP-FPM&#8221; is enabled for the domain, if not then enable it.<\/p>\n\n\n\n<h2 class=\"wp-block-heading has-normal-font-size\" id=\"h-2-php-ini-file\"><strong>2. php.ini File<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">It is always important to understand the current PHP configuration. You can find the existing php.ini file by creating a PHP info page.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Now, Create a file named phpinfo.php in your web root directory. Here I am using the root directory as: \/home\/testdomain.com\/public_html\/<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#cd \/home\/testdomain.com\/public_html\/\n# vim phpinfo.php<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Add the following content to the file:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>&lt;?php<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>phpinfo();<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>?&gt;<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">After changing the necessary file permissions, Access this file via your web browser (e.g., http:\/\/testdomain.com\/phpinfo.php).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In the page, Verify that <strong>PHP_FPM<\/strong> is active or not.<\/p>\n\n\n\n<h2 class=\"wp-block-heading has-normal-font-size\" id=\"h-3-review-and-modify-php-ini-directives\"><strong>3. Review and Modify php.ini Directives<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">You can review the domain\u2019s php.ini directives in cPanel\u2019s MultiPHP INI Editor interface (cPanel \u00bb Home \u00bb Software \u00bb MultiPHP INI Editor).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In WHM, you can review this in (WHM \u00bb Home \u00bb Software \u00bb MultiPHP INI Editor). You can find the system set default php.ini directive there<a href=\"https:\/\/cpanel.net\/\" target=\"_blank\" rel=\"noopener\">.<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading has-normal-font-size\" id=\"h-for-global-modifications\"><strong>For Global Modifications:<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">First, SSH into your server.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">And then look for \/var\/cpanel\/ApachePHPFPM\/system_pool_defaults.yaml. If it does not already exist, create it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To modify the.yaml file, use the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#vim \/var\/cpanel\/ApachePHPFPM\/system_pool_defaults.yaml<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Add the desired PHP-FPM pools and directives. for example you can set the memory limit of 120 MB by adding the following:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>php_admin_value_memory_limit: { name: 'php_admin_value&#91;memory_limit]', value: 120M }<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading has-normal-font-size\" id=\"h-for-modifying-specific-php-ini-directives-for-a-domain-nbsp\"><strong>For Modifying specific php.ini directives for a domain,&nbsp;<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Create the file \/var\/cpanel\/userdata\/username\/testdomain.com.php-fpm.yaml, then edit it with a text editor to add the directives you want to modify.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">for example, to disable the passthru and system directives, use:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#vim \/var\/cpanel\/userdata\/username\/testdomain.com.php-fpm.yaml<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>_is_present: 1\nphp_admin_value_disable_functions: { name: 'php_admin_value&#91;disable_functions]', value: passthru,system }<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">To enable all the directives, using the following:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>_is_present: 1\nphp_admin_value_disable_functions: { name: 'php_admin_value&#91;disable_functions]', value: none }<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading has-normal-font-size\" id=\"h-4-regenerate-the-configuration-and-restart-the-services\"><strong>4. Regenerate the configuration and restart the services<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">After the modifications has been made, Regenerate the php-fpm configuration:&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#\/usr\/local\/cpanel\/scripts\/php_fpm_config --rebuild<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Restart the apache and php-fpm services for the changes to take effect:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#\/usr\/local\/cpanel\/scripts\/restartsrv_apache_php_fpm\n#\/usr\/local\/cpanel\/scripts\/restartsrv_httpd<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">By following these steps, you can effectively manage your PHP settings, ensuring optimised performance.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you have any questions or need personalized assistance with &#8220;How to Manage PHP.ini Directives with PHP FPM on a cPanel Server&#8221; , don\u2019t hesitate to reach out&nbsp;<a href=\"https:\/\/www.skynats.com\/blog\/\">Skynats<\/a>. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Manage PHP.ini Directives with PHP FPM on cpanel can be useful for altering PHP configurations to specific application requirements. When using PHP-FPM alongside cPanel, the process becomes more streamlined and efficient.PHP-FPM (FastCGI Process Manager) significantly elevates PHP performance and provides more granular control over PHP settings. This blog post will take you through the steps [&hellip;]<\/p>\n","protected":false},"author":13,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[416,5,764,224],"tags":[870,869],"class_list":["post-12510","post","type-post","status-publish","format-standard","hentry","category-cpanel-server-management","category-blog","category-cpanel","category-php-8-0","tag-cpanel-server","tag-php-fpm"],"_links":{"self":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts\/12510","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/comments?post=12510"}],"version-history":[{"count":1,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts\/12510\/revisions"}],"predecessor-version":[{"id":16386,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts\/12510\/revisions\/16386"}],"wp:attachment":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/media?parent=12510"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/categories?post=12510"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/tags?post=12510"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}