MultiPHP Manager vs .htaccess PHP Version Overrides: Uncertain Precedence in Production
0 reputation · 27 Dec 2020, 10:43 UTC
0 reputation · 27 Dec 2020, 10:43 UTC
Determine which configuration source – the MultiPHP Manager or a per‑domain .htaccess directive – ultimately decides the PHP version that a cPanel shared hosting account uses in a production environment.
In local development a single PHP binary is used, so the application runs under a known PHP version. On the production cPanel server, PHP can be served via suPHP, FastCGI, or mod_php, and the MultiPHP Manager allows a site‑wide default to be overridden by a .htaccess AddHandler or SetHandler directive. The interaction between these two mechanisms is not well documented and can lead to 500 errors when unsupported directives are present.
.htaccess override reference the same PHP 8.2 binary, but the handler type differs (FastCGI vs suPHP)..htaccess PHP version directive are present, which takes precedence in a CloudLinux‑enabled cPanel shared hosting environment?.htaccess (e.g., AddHandler php8.2‑fcgid .php) override the MultiPHP Manager’s handler selection, or is the MultiPHP Manager always authoritative?.htaccess override is ignored because the MultiPHP Manager enforces a system‑wide default for security or performance reasons?35275 reputation · 27 Dec 2020, 11:53 UTC
1. Precedence: In a CloudLinux‑enabled cPanel shared environment the MultiPHP Manager (or the PHP Selector UI) is authoritative. It writes a domain‑specific .htaccess file under /usr/local/apache/conf/userdata/domain/… that sets the PHP version and handler. Apache processes this file after the main server configuration and before any user‑created .htaccess in the same directory, so any conflicting AddHandler or SetHandler lines in a user .htaccess are overridden or ignored.
2. Handler type: The handler type declared in a user .htaccess (e.g., AddHandler php8.2-fcgi .php) cannot override the handler chosen by the MultiPHP Manager. If the manager selects FastCGI, the server will run PHP via php‑fpm regardless of any suPHP directive you try to add in .htaccess.
3. Ignored overrides: CloudLinux’s PHP Selector enforces the version set in cPanel. When enabled, any per‑user .htaccess attempt to change the PHP version or handler that conflicts with the selector is silently ignored, and may result in 500 errors if unsupported directives are present. The only supported way to change the PHP version or handler is through the cPanel UI.
.htaccess in /usr/local/apache/conf/userdata/domain/… that contains AddHandler and SetHandler directives matching the selected PHP version and handler..htaccess in public_html, giving it precedence..htaccess for versioning are ineffective and can break opcode caches..htaccess does not match the MultiPHP Manager’s handler, Apache silently ignores the user directive and uses the manager’s handler..htaccess:
/usr/local/apache/conf/userdata/domain/…).
.htaccess file.
AddHandler / SetHandler lines as shown in the MultiPHP Manager.
.htaccess (if any):
/home/username/public_html/.htaccess, look for any AddHandler or SetHandler lines.
phpinfo.php file in public_html with the contents:
FPM/FastCGI, suPHP) section. They should match the MultiPHP Manager’s selection.
sudo systemctl restart php-fpm
To confirm that the handler mismatch is the cause of any 500 errors you’re seeing, could you provide the Server API line from a phpinfo() page on the affected domain? That will show whether the runtime is using FastCGI, suPHP, or another handler.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.