jonnott

Registered
Sep 8, 2014
4
0
1
cPanel Access Level
Reseller Owner
Two issues that cause us big existential issues (!) regarding ea/cPanel..

1. That suPHP seems to require a line in the web root's .htaccess file to point to the correct PHP executable. This causes problems with management of the .htaccess within, projects, problems with doing local dev elsewhere, and particularly with frameworks like Laravel, Symfony etc where the .htaccess file is basically there to route all requests via the front controller.
Would like to know:
- what's the reason this configuration cannot be elsewhere, i.e. not in the .htaccess file (some other per-site Apache config?)
- if there's any roadmap or future likelihood of avoiding this line in .htaccess when using a suPHP version of PHP with ea.

2. That a cPanel server cannot have the same PHP version running as both DSO and suPHP at the same time. This causes problems if you want to upgrade the server-wide DSO PHP version (e.g. from PHP 5.6 to 7.0), but don't want to affect sites that may already be using e.g. 7.0, but via suPHP instead.
Would like to know:
- what the technical reasons are why this situation exists
- if there's any roadmap or future likelihood of being able to run the same PHP version via DSO and suPHP simultaneously

Thanks!
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,910
2,215
363
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:

Submit A Feature Request

2. In part it's because each PHP handler interacts with the Apache web server differently. For instance, suPHP is not compatible with the mpm_itk or the mod_ruid2 Apache module. You can read more about the each PHP handler at:

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.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,910
2,215
363
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:

Code:
# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php70” package as the default “PHP” programming language.
<IfModule mime_module>
  AddType application/x-httpd-ea-php70 .php .php7 .phtml
</IfModule>
# 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.
 

jonnott

Registered
Sep 8, 2014
4
0
1
cPanel Access Level
Reseller Owner
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?

Code:
# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php56” package as the default “PHP” programming language.
<IfModule mime_module>
  AddType application/x-httpd-ea-php56 .php .php5 .phtml
</IfModule>
# 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.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,910
2,215
363
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:

Put PHP version choices in server configuration

I encourage you to vote and add feedback to this request.

Thank you.