简体   繁体   English

为什么PHP无法在我的.html页面中正确解析?

[英]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). 我的网站使用HostGator共享托管(是的,我知道,这是我的第一个错误)。 I'm looking to redesign it, but before I do, I need to fix a PHP parsing problem. 我正在寻找重新设计它的方法,但在此之前,我需要解决一个PHP解析问题。

All of the site's pages are HTML (.html). 该网站的所有页面均为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. 但是,我一直使用PHP插入日期,时间,随机文本等。突然,PHP停止在站点的所有.html页面中进行解析,即使我没有触摸htaccess文件也是如此。 Simple PHP code no longer works. 简单的PHP代码不再起作用。 For example: 例如:

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

My default PHP is set to PHP 5.6. 我的默认PHP设置为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). HostGator声称“不在[服务范围内]”来帮助我弄清楚发生了什么(即使很明显,他们最终更改/更新了某些内容)。

The following worked perfectly in .htaccess for years, but now it results in a "500 error": 下面的代码在.htaccess中可以完美运行多年,但是现在导致“ 500错误”:

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: 我也分别在htaccess中尝试了以下每个操作,但均无济于事:

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. 其中一些选项会导致“ 500错误”,而其他选项则完全无效。

I'd greatly appreciate some help in resolving this problem. 我非常感谢您为解决此问题提供的帮助。 (Changing the extension to ".php" is not an option.) Thank you! (不能将扩展名更改为“ .php”。)谢谢!

UPDATE: There is no updating "log" or "error" file anywhere in my FTP interface. 更新:我的FTP界面中的任何地方都没有更新的“日志”或“错误”文件。 Also, the only entries in Hostgator's "Last 300 Error Log messages" page in cPanel look like this: 另外,cPanel中Hostgator的“最近300条错误日志消息”页面中的唯一条目如下所示:

[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/

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. 提示问题出在html文件的文件权限。 So change them from 664 to 644 to make them not-group-writeable. 因此,请将其从664更改为644,以使其不能进行组写入。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM