Host changed their PHP version and htaccess HTML run as PHP no longer works

Hello. Hostgator changed their PHP version and now htaccess HTML run as PHP no longer works. Help Please

My current htacces code

AddHandler application/x-httpd-php5 .html .htm

Hostgator is running php 7.4 now. I tried removing the 5 from above and no go. I’m guessing this has to be the issue to my site here shorturl.at/lvwJ3. Because all of a sudden its not using the CSS which is linked to in a php include.

Have you tried changing it to the following…

AddHandler application/x-httpd-php74 .html .htm .php

Have you also seen this article?

https://www.hostgator.com/help/article/php-configuration-plugin

What are the exact errors you are getting?

I just tried adding 74 and no go. And yes I did update the php. Or rather conform it already was. Any other guesses why it wont use the css?

There’s a hostgator article concerning this with slightly different naming for the value (an extra -ea-) - https://www.hostgator.com/help/article/how-to-execute-php-in-html-files

If you would rather not have the carpet pulled from underneath your feet I highly recommend looking into hosting your site in the cloud on a virtual server. In the cloud on a leased or dedicated virtual machine you have complete control over server configuration. No longer need to worry about the host changing something that brings down your entire site.

1 Like

On the flip side, when things go sideways you have to fix them yourself. You can’t call the hoster to ask if they fix it for you.

1 Like

Yes that did it! Thank you very much mabismad life saver.

Huh one more issue remaining… The custom error404.html page now wont parse html as php. So none of the includes work just on that page alone. Any guesses as to why for that?

The site in question is here if that helps shorturl.at/lnHU7

Yes, you do need to know what you are doing. Can’t just toss stuff over a fence and expect it to work.

You can also scale an application using multiple virtual servers and load balancing traffic between them. The load balancer will distribute traffic evenly between servers reducing over all load on a single instance. Load balancing provides higher availability, reliability, and performance with the exception of the database server unless that is scaled as well.

In high contrast to a managed or shared server the possibilities and growth opportunities are endless in the cloud.

I can’t guess why, but would it not be easy enough to change error404.html to error404.php ?

2 Likes

Where is the custom error page stored? If it is not in the same folder as the main htaccess file with the AddHandler … line, is there an additional htaccess that could override the main AddHandler … line? Are there any file/folder conditionals in any htaccess that could prevent or override the main AddHandler … line?

its name is error404.html. Its located in the root. All the php includes within the error404.html page are absolute links with full url. Only one htaccess and the code for the custom error page is ErrorDocument 404 /error404.html. For the time being I just removed al the includes so the error page works. But it still erks me that I dont know why php cant run on that page.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.