cPanel-generated php ini directives
In my .htaccess file I have the following:
Why is cPanel adding this? I noticed that on some server it's not being added. Is there a way to not add the code?
# BEGIN cPanel-generated php ini directives, do not edit
# Manual editing of this file may result in unexpected behavior.
# To make changes to this file, use the cPanel MultiPHP INI Editor (Home >> Software >> MultiPHP INI Editor)
# For more information, read our documentation (https://go.cpanel.net/EA4ModifyINI)
php_flag display_errors On
php_value max_execution_time 30
php_value max_input_time 60
php_value max_input_vars 1000
php_value memory_limit 32M
php_value post_max_size 50M
php_value session.gc_maxlifetime 1440
php_value session.save_path "/var/cpanel/php/sessions/ea-php80"
php_value upload_max_filesize 50M
php_flag zlib.output_compression Off
php_flag display_errors On
php_value max_execution_time 30
php_value max_input_time 60
php_value max_input_vars 1000
php_value memory_limit 32M
php_value post_max_size 50M
php_value session.gc_maxlifetime 1440
php_value session.save_path "/var/cpanel/php/sessions/ea-php80"
php_value upload_max_filesize 50M
php_flag zlib.output_compression Off
# END cPanel-generated php ini directives, do not edit
# php -- BEGIN cPanel-generated handler, do not edit
# Set the "ea-php80" package as the default "PHP" programming language.
AddHandler application/x-httpd-ea-php80 .php .php8 .phtml
# php -- END cPanel-generated handler, do not edit
Why is cPanel adding this? I noticed that on some server it's not being added. Is there a way to not add the code?
-
Hey, That is added by cPanel's MultiPHP INI Editor and by cPanel's MultiPHP Manager: If you use these tools to modify a domain/subdomain's PHP settings and/or version, then those lines are added to your .htaccess file, and a php.ini file is created too. It's standard behavior, don't worry. If some sites don't have it, it's simply because you haven't used those tools on them (or because the lines were removed). In case you want that code deleted, you can do it by using the mentioned tools, though keep in mind that you may break the site if you do this. 0 -
Thank you for the above links and information. I'm still unclear why it's added. What useful purpose does it serve? If the code can be deleted without any effect it would appear to have no useful purpose. 0 -
Hello! As @Babene7 said, most of those directives are added from within the MultiPHP INI Editor and can be removed/edited from within that interface as well. A few of the directives are necessary for setting the PHP handler and version so those cannot be removed, but you can change the PHP values such as max_input_time. 0 -
Hello! As @Babene7 said, most of those directives are added from within the MultiPHP INI Editor and can be removed/edited from within that interface as well. A few of the directives are necessary for setting the PHP handler and version so those cannot be removed, but you can change the PHP values such as max_input_time.
Hello, I'm not finding this to be the case. I have removed the entire code without any issue. Can you double check if the code is actually needed. Thank you.0 -
Hello, although removing the code may not directly result in an error on the website, I wouldn't recommend doing this as it could cause unforeseen issues. The code is used by cPanel to manage the PHP configuration for the domain. Whenever a user makes a change via the MultiPHP INI Editor or MultiPHP INI Manager some of the code would get added back automatically. Did you have a specific reason you were needing to remove the code? 0 -
I wouldn't recommend doing this as it could cause unforeseen issues.
In my experience over the years, removing this code has never caused issues. The reason I would like to see this code not added in the first place is to make the .htaccess file easier to understand.0 -
Perhaps the reason for the code is to allow different domains to run different versions of PHP. So if you only have one domain the default PHP directives in cPanel apply and removing the code in the .htaccess file will not be an issue. 0 -
Hello, [QUOTE]Perhaps the reason for the code is to allow different domains to run different versions of PHP. So if you only have one domain the default PHP directives in cPanel apply and removing the code in the .htaccess file will not be an issue.
Correct, the directives added by cPanel are mostly used to manage different PHP versions between your domains. If none of the code was inserted, the domain would use the server's default PHP version. For example, if you set the domain to Inherit in the MultiPHP Manager in WHM, only the following should be added to the .htaccess which should not affect the website:# php -- BEGIN cPanel-generated handler, do not edit # This domain inherits the "PHP" package. # php -- END cPanel-generated handler, do not edit0 -
only the following should be added to the .htaccess which should not affect the website:
I cannot get the above 3 line comment to show. I do the following I first delete the code in my .htaccess file which is shown in post #1. I have set the WHM -> Inherit - PHP 8.0 ( ea-php80 ) I then make a change in cPanel -> MultiPHP INI Editor and Apply. The code as shown in post #1 is added to the .htaccess file. I was hoping to only get the 3 line as indicated by cPanelWilliam.0 -
Hi, Making changes within the cPanel MultiPHP INI Editor will add some directives back to the .htaccess. For example, you may see the default PHP directives added to the .htaccess such as the following after saving changes with the cPanel MultiPHP INI Editor: php_flag display_errors Off php_value max_execution_time 60 php_value max_input_time 60 php_value max_input_vars 1000 php_value memory_limit 32M php_value post_max_size 8M php_value session.gc_maxlifetime 1440 php_value session.save_path "/var/cpanel/php/sessions/ea-php80" php_value upload_max_filesize 2M php_flag zlib.output_compression Off
This additional code shouldn't cause any issues as the only directives that are changed are the ones changed by the user within the MultiPHP INI Editor. You could restore the .htaccess from an older copy to revert this code, but the additional code would get added back whenever a change is saved via the MultiPHP INI Editor in cPanel.0 -
but the additional code would get added back whenever a change is saved via the MultiPHP INI Editor in cPanel.
Is this something new? I don't recall having this code added to the .htaccess file over the years.0 -
Hi, [QUOTE]Is this something new? I don't recall having this code added to the .htaccess file over the years.
I believe the additional code added in the .htaccess from the MultiPHP INI Editor has been around since the introduction of EasyApache 4 since this allowed the use of multiple PHP versions across different domains. If you had an older server that used EasyApache 3 it could explain the difference in behavior you're seeing.0 -
Thank you kindly for all your help, William. It's nice to understand how things work. 0
Please sign in to leave a comment.
Comments
13 comments