Skip to main content

htaccess and PHP versions questions

Comments

5 comments

  • cPanelMichael
    Hello @jonnott, 1. The entries in the .htaccess file make it possible for an individual cPanel user to change the version of PHP assigned to the account as part of the cPanel >> MultiPHP Manager feature and to ensure changes made through cPanel >> MultiPHP INI Editor are preserved if the handler changes in the future. You can read more about this at: MultiPHP INI Editor for cPanel - Version 74 Documentation - cPanel Documentation There are currently no plans to change this behavior going forward, but I encourage you to open a feature request if this is something you'd like to see modified: PHP Handlers - EasyApache 4 - cPanel Documentation There are currently no plans to allow for the use of multiple PHP handlers on a single PHP version. Out of curiosity, is there any reason you prefer to use a handler such as DSO or suPHP instead of one like PHP-FPM? Thank you.
    0
  • jonnott
    Would PHP-FPM help with either of these issues?
    0
  • cPanelMichael
    Would PHP-FPM help with either of these issues?

    Hello @jonnott, 1. The following entry is still added to the .htaccess file when using PHP-FPM: # php -- BEGIN cPanel-generated handler, do not edit # Set the "ea-php70" package as the default "PHP" programming language. AddType application/x-httpd-ea-php70 .php .php7 .phtml # php -- END cPanel-generated handler, do not edit
    This is how the PHP version is assigned to the account as part of the MultiPHP functionality, so I don't believe using PHP-FPM will help in that respect. 2. PHP-FPM is a PHP handler, however it doesn't have to be the default handler assigned to the PHP version. For example, you can make suPHP the default PHP handler for PHP version 7.0 and then enable/disable PHP-FPM for domain names using PHP version 7.0 via WHM >> MultiPHP Manager. Thus, technically you can have two PHP handlers available at the same time on the same PHP version (as long as one of them is PHP-FPM). Thank you.
    0
  • jonnott
    Hello @jonnott, There are currently no plans to change this behavior going forward Thank you.

    I guess my question is simply .. is it technically possible for the below configuration (which is currently added to the web root's .htaccess file) to be added elsewhere in Apache configuration instead .. e.g. to a vhost-specific .conf file? Even if this is something which might be a toggle-able option within cPanel, which I could propose a feature request for? # php -- BEGIN cPanel-generated handler, do not edit # Set the "ea-php56" package as the default "PHP" programming language. AddType application/x-httpd-ea-php56 .php .php5 .phtml # php -- END cPanel-generated handler, do not edit
    My principle objection to it being in .htaccess is this interferes with many common PHP frameworks which use .htaccess for essential settings, and also for many projects this file contains project-specific settings, not environment-specific settings, so having the EA-related settings in the .htaccess (which is often under version control) interferes with other environments, e.g. a local dev environment. The fact that frameworks come with .htaccess files out of the box, means the .htaccess file is always under version control for project created using those frameworks.
    0
  • cPanelMichael
    Hello @jonnott, While it's technically possible to move the AddType entry from the .htaccess file to the individual virtual host, doing so is unsupported because other features such as PHP version detection via CLI rely on the entries in the .htaccess file. It looks like an existing feature request is open for what you are seeking at:
    0

Please sign in to leave a comment.