Skip to main content

cPanel-generated php ini directives

Comments

13 comments

  • AndyX
    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
  • cPanelWilliam
    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
  • AndyX
    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
  • cPanelWilliam
    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
  • AndyX
    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
  • AndyX
    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
  • cPanelWilliam
    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 edit
    0
  • AndyX
    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
  • cPanelWilliam
    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
  • AndyX
    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
  • cPanelWilliam
    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
  • AndyX
    Thank you kindly for all your help, William. It's nice to understand how things work.
    0

Please sign in to leave a comment.