PHP Handler keeps reseting?
So I have PHP 8.1 and 8.5. 8.1 is the default. Half the accounts are 8.1, half are 8.5. I have .html added to my PHP handler in all the /home/user/www/.htaccess files whether the user is using 8.1 or 8.5. same thing. I have to add the .html to the end of the handler because it cannot be automated. This is fine.
eg. AddHandler application/x-httpd-ea-php85 .php .php8 .phtml .html
Every few nights or whatever my maintenance script runs. The sites that are manually set to 8.5 (Inherit?) have the .html removed and reset. The 8.1 sites have the .html left on and its not touched. Now half my sites are not functioning because I need PHP to parse .html.
Why? I always want .html added and kept whether automated or manual. Yet it won't automate it, and when I do it manually during my slow migration to 8.5, it strips it away (because its re-checking the sites to ensure they are still on 8.5?).
How do I fix this? I'm running cPanel/WHM 132.0.23.
-
Hey there! Can you let me know the specific code you're adding and where in the file you're adding that? Are you just adding the ".html" text to the end of that line?
If you could paste the entire .htaccess file so I could see specifically where you're making this change I may be able to get you better information.
0 -
I'm not really adding code, just ".html". So here is a /home/user/www/.htaccess file that was set to use PHP 8.5 in PHP Multi Manager. I then edited this file and added .html at the end so it was:
AddHandler application/x-httpd-ea-php85 .php .php8 .phtml .html
Then I come back the next day and .html is gone. The .htaccess is now back to this:
RewriteEngine on
Options -Indexes# Disable all error logging via custom PHP
<Files php.ini>
order allow,deny
deny from all
</Files># STUFF HERE
# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php85” package as the default “PHP” programming language.
<IfModule mime_module>
AddHandler application/x-httpd-ea-php85 .php .php8 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit0 -
So there you go - that won't work because you can't edit anything in that block. The best way to handle this for a specific site will be to use a custom Apache Handler as outlined here, which should be available in the specific cPanel interface.
https://docs.cpanel.net/cpanel/advanced/apache-handlers/
Like we found in https://support.cpanel.net/hc/en-us/community/posts/37757346098455-Automatically-add-html-to-PHP-handler I don't have a way to make this change global for all accounts by default.
Is that something you'd like me to make a feature request for - allow a method to edit the default handler?
0 -
I guess I'll set the server default to PHP 8.5 and then it won't try to change it anymore. Thats what it does with with 8.1 when it is the default.
0
Please sign in to leave a comment.
Comments
4 comments