htaccess files keep getting changed
In recent weeks, the .htaccess files for hundreds of my website accounts (hosted as a reseller under HostGator) keeps getting edited and it is causing issues with full operation of my website CMS.
I have my htaccess files all setup with this line only:
AddHandler application/x-httpd-ea-php74___lsphp .php .php7 .phtml .html .htm
But cPanel keeps adding this:
# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php82” package as the default “PHP” programming language.
<IfModule mime_module>
AddHandler application/x-httpd-ea-php82___lsphp .php .php8 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit
My CMS needs the handler set to get PHP to run on html pages using 7.4.
8.2 causes issues.
4 questions:
Why does cPanel keep modifying my htaccess files?
I notice it modified them a few weeks ago as well but only for websites that had PHP databases setup on the hosting account. Why?
How do I get cPanel to stop updating these htaccess files?
Who determines when PHP versions get depracated - is cPanel initiating this or HostGator? I never know when these depracations are coming and it causes problems.
THANK YOU IN ADVANCE!
-
Go to cPanel -> Software -> MultiPHP Manager
and set PHP 7.4 for that domain.Apparently in your cPanel the setting is Inherit and server's default PHP version is 8.2.
0 -
Had NO idea I could do that. I tried that but my only available options are 8.1, 8.2 and 8.3. Does HostGator have to allow me previous versions or can this be enabled somehow in WHM?
Thank you!
0 -
I don't think you can do that in reseller WHM, I suggest you contact HostGator support.
0 -
Checking with them, thanks. Another question: Is it 100% necessary to wrap the addhandler text with:
<IfModule mime_module>
</IfModule>
I don't always and I am wondering if that's why cPanel keeps overwriting my 7.4 handlers with the 8.2 handlers.
0 -
Another question:
Is it less effective to modify the htaccess file directly by editing it on the server versus going into cpanel > Apache Handlers and setting it there?
0 -
What specific change are you making to the .htaccess file? If you're editing that AddHandler line, then yes, cPanel will overwrite that and you'll want to speak with your host about setting the PHP version correctly for your account. You can not edit that section of the file manually.
0 -
Yes, it's the handler noted in my original post. Sometimes I set it by editing the htaccess file myself. Sometimes I set it in the cPanel. But either way, it keeps getting overwritten by cPanel every few months apparently by a much newer version, which my CMS doesn't work with. So there's no way to stop these automatic overwrites by cPanel?
0 -
Correct - cPanel is always going to overwrite that file to match the settings configured in other areas of the system. The best thing you can do is contact your host so they can make the changes your want permanent for your account.
0
Please sign in to leave a comment.
Comments
8 comments