PHP version keeps changing automatically

Soren Beck Jensen

Registered
Jul 11, 2019
2
0
1
Granada, Spain
cPanel Access Level
Root Administrator
We have been having this issue for ages, and have even moved servers because we thought our last provider was doing something wrong. But the issue has followed us. We have observed this issue on at least 2 different sites, but it mostly happens to one specific site (our most important one of course). It happens at all times of day and with 2-3 weeks in between, sometimes only days. Last night it happened at 03:34 where I am 100% sure no one was working on it. But as said, it has also happened during the day

The bottom bit of our .htaccess file is changed from:

Apache config:
# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php73” package as the default “PHP” programming language.
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php73___lsphp .php .php7 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit
to

Apache config:
# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php54” package as the default “PHP” programming language.
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php54___lsphp .php .php5 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit
But the really weird bit is that it still shows as php 7.3 in both cPanel and WHM screens. Just now when checking I have realized that the two domain that it has happened on both have subdomain that use the older version of PHP so it is likely this is related.

1585815593382.png
To fix the issue, we set the site back to and older version and then back to 7.3 again. To re-iterate... the above does not change, only the .htaccess changes (when the problem happens).

Any help will be appreciated.
 

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,296
1,252
313
Houston
@Soren Beck Jensen I don't know of anything that would change the AddHandler in that specific IfModule, some software might add an AddHandler but not modify the existing one from what I've seen.

I noticed that the payment subdomain is noted as being affected by changes to the root domain. Is there not an .htaccess in the payment.subdomain's document root? Within that .htaccess is the AddHandler set? Furthermore is the PHP version for those two sites (the root domain and subdomain) the same across all avenues? Which OS are you running? CentOS or CloudLinux?
 
Last edited:

Soren Beck Jensen

Registered
Jul 11, 2019
2
0
1
Granada, Spain
cPanel Access Level
Root Administrator
I have now changed the subdomain to also run 7.3 so I am not sure if there was one. I would imagine that there was as the default version is 7.3 so any domain not running 7.3 must have been set and using an .htaccess. I am quite convinced that the issue stemmed from subdomains running an older version, but I am not sure. If we experience the issue again (now after having changed the subdomain) I will update this thread. For other users experiencing this, I recommend setting all sub domains to the same PHP version.
 

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,296
1,252
313
Houston
Well, actually what I was suggesting was that there wasn't an .htaccess in the payment subdomain's document root and I'd wanted to see if adding one actually resolved the issue for you. There should be no issue having different PHP versions in different subdomains, I have a similar configuration on my testing server with no issues.
 

dk123

Registered
Jun 3, 2020
1
1
0
Melbourne
cPanel Access Level
Website Owner
i have the exact same problem. googling for answers and ended up here. I keep changing the htaccess file to an updated php version, exactly the same as in the original post. then randomly when i return to wordpress i get messages that my php needs updating, and when i check the htaccess file again, it has reverted to the addhandler with php5 info.
 
  • Like
Reactions: james102338

ffeingol

Well-Known Member
PartnerNOC
Nov 9, 2001
437
105
343
cPanel Access Level
DataCenter Provider
It's a longshot, but are you running WordPress on either of these domains? We had a client running a WordPress plugin (sorry I can't remember the name) and the plugin backed up all the files in the site and automatically put them back if they were changed outside of WordPress. This drove us crazy for a while until we figured out what it was.
 

AikiDigital

Registered
Jul 9, 2020
1
0
1
US
cPanel Access Level
Root Administrator
Thanks for that tip, ffeingol
I am having a similar issue and I was suspecting that a plugin was writing to .htaccess and causing this to happen for us as well. Any chance you might remember which plugin it was or even what type of plugin it was (backup, caching, optimization?)
 

imorandin

Member
PartnerNOC
Nov 20, 2014
11
1
53
cPanel Access Level
DataCenter Provider
Hi. I have the same problem in 2 accounts in different servers. One site is Wordpress but the other is not (custom PHP site).
I think that this has to do with cpanel update because the htaccess modification time is the same as the upcp log.
 

ffeingol

Well-Known Member
PartnerNOC
Nov 9, 2001
437
105
343
cPanel Access Level
DataCenter Provider
The only other instance we've see of this is when the customer went in (or their software) rewrote the .htaccess file and removed the cPanel code to set the PHP version. There seems to be something that runs nightly and makes sure the the PHP version (or lack of) in the .htaccess matches what they have configured via cPanel. This is just observation, someone from cPanel will have to confirm this behavior.
 

kesz1

Registered
Oct 15, 2020
1
0
0
NJ
cPanel Access Level
Website Owner
Anyone find a solution? I have 12 subdomains on one site (custom php) and have the same issue as the OP. The .htaccess file reverts php back to 5.6 from 7.3. When I login to PHP manager the sites still show 7.3 and I have to reset them to 7.3 (weird I know) in order to rewrite the .htaccess file.