user level PHP ini file How to set base ini file for whole account

martin MHC

Well-Known Member
Sep 14, 2016
317
71
78
UK
cPanel Access Level
Root Administrator
PHP FPM / PHP 8.1

Many years ago in an older CPanel we needed to have the custom user php ini file (user.ini or similar) appear in every single folder in a web domain for the PHP files in the folder to follow these rules.

At some point more recently, this system changed (still at least a couple years ago) so that a single user.ini file can be placed in the root public_html of the account and would affect all sub folders.

Now, since the most recent update to WHM 102.0.24 the behaviour has reverted and now non-root path PHP files in sub folders of public_html no longer use the settings. It seems that this tweak has been reverted. I believe it's this tweak as we have not changed any relevant settings on the server outside of the latest WHM update

How can I fix this so that the single user.ini in the base path of an account applies to all subfolders on the account again ?
 

martin MHC

Well-Known Member
Sep 14, 2016
317
71
78
UK
cPanel Access Level
Root Administrator
CAUSE FOUND:

Issue appears to be caused by updating/uploading changes to the root .htaccess file makes the WHM/Cpanel system apply the default PHP version (in this case 7.4). This is not recorded in the PHP Manager aspects of WHM which still erroneously states PHP 8.1 is active. The PHPinfo file states the actual version that is running.
 
Last edited:

martin MHC

Well-Known Member
Sep 14, 2016
317
71
78
UK
cPanel Access Level
Root Administrator
cPanel uses the main .htaccess file to determine the PHP version for the domain, so if that is modified in an unintended way, it will cause this issue with the system.
I have realised this now, but the WHM PHP manager doesn't update - still stating PHP8.1 was running on the account. Maybe this should be reported as a glitch to fix?

( using suPHP handler )
 

martin MHC

Well-Known Member
Sep 14, 2016
317
71
78
UK
cPanel Access Level
Root Administrator
Can you explain the possible glitch a bit more? I'm not sure I'm following that.
Updating the root .htaccess on the account seems to silently change the account PHP version to the server default, rather than that defined by the PHP Manager settings in WHM. So the account becomes unstable / error logged due to this. Checking the multiPHP Manager in WHM this still shows the account has the PHP version previously set (8.1) but the account is actually running PHP 7.4 (server default).

This is using the suPHP handler. Server default PHP version is 7.4 .
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
13,463
2,114
363
cPanel Access Level
Root Administrator
That sounds right to me. That's why there is the "do not edit" warnings inside the .htaccess code:

Code:
# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php80” package as the default “PHP” programming language.
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php80 .php .php8 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit
If things are adjusted in there, cPanel will get out of sync, as you have found.