Jason
Jason

Reputation: 51

Why is PHP no longer parsing correctly in my .html pages?

My site is with HostGator shared hosting (yes, I know, that’s my first mistake). I'm looking to redesign it, but before I do, I need to fix a PHP parsing problem.

All of the site's pages are HTML (.html). However, I have always used PHP to insert dates, times, random text, etc. Suddenly, PHP stopped parsing in all .html pages of the site, even though I did not touch my htaccess file. Simple PHP code no longer works. For example:

<?php print date('Y'); ?>

My default PHP is set to PHP 5.6. HostGator claims that it's "outside the scope of [their] service" to help me figure out what happened (even though it's obvious that they changed/updated something on their end).

The following worked perfectly in .htaccess for years, but now it results in a "500 error":

Options +ExecCGI
AddHandler fcgid-script .html
FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .html

I have also individually tried each one of the following in htaccess, to no avail:

AddHandler application/x-httpd-php .html .htm
AddHandler application/x-httpd-php .php .htm .html
AddHandler application/x-httpd-php .php5 .php4 .php .php3 .php2 .phtml
AddHandler application/x-httpd-php5 .html .htm
AddHandler application/x-httpd-php5 .php
AddHandler application/x-httpd-php5 .php .html
AddHandler application/x-httpd-php54 .php
AddHandler application/x-httpd-php54 .php .html
AddHandler application/x-httpd-php54s .php
AddHandler application/x-httpd-php56 .php
AddHandler application/x-httpd-php56 .html
AddHandler application/x-httpd-php56 .php5 .php4 .php .php3 .php2 .phtml
AddHandler fcgid54-script .php
AddHandler php-script .php .html .htm
AddHandler php5-script .php .html .htm
AddHandler x-httpd-php .html .htm
AddType application/x-httpd-php .php .htm .html`

Some of those options result in a "500 error," while the others have no effect at all.

I'd greatly appreciate some help in resolving this problem. (Changing the extension to ".php" is not an option.) Thank you!

UPDATE: There is no updating "log" or "error" file anywhere in my FTP interface. Also, the only entries in Hostgator's "Last 300 Error Log messages" page in cPanel look like this:

[Thu Nov 08 03:32:04 2018] [error] [client xx.xxx.xxx.xxx] SoftException in Application.cpp:313: File "/home4/.../public_html/index.html" is writeable by group, referer: https://www.********.com/

Upvotes: 1

Views: 210

Answers (1)

Karsten Koop
Karsten Koop

Reputation: 2524

The error message

File "/home4/.../public_html/index.html" is writeable by group

suggests that the problem is the file permissions of your html files. So change them from 664 to 644 to make them not-group-writeable.

Upvotes: 2

Related Questions