非 PHP 站点生成 PHP 错误
我出现这个错误:
解析错误:语法错误,第 1 行 /home/ondesign/public_html/ywamleicester.org/index.html 中出现意外的 T_STRING
我认为这是一个 PHP 错误。然而,该网站是一个开箱即用的 iweb 设计,其中没有 PHP。
我不知道能做什么。
I have this error appearing:
Parse error: syntax error, unexpected T_STRING in /home/ondesign/public_html/ywamleicester.org/index.html on line 1
Which I think is a PHP error. However, the site in question is an out of the box iweb design with no PHP in it.
I have no idea what could be doing it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
可能是服务器配置错误,将 .html 文件视为可以包含 PHP 代码。可能想要检查服务器配置为用于 PHP 的扩展。
Could be that the server is misconfigured to treat .html files as if they can contain PHP code. Might want to check what extensions the server is configured to use for PHP.
您的服务器应配置为将 html 文件视为 php。
它抛出解析错误的原因应该是因为您的页面使用 XHTML,并且 XML 声明以
开头,
如果
short_open_tags
设置为on
,它可以在第一行用“xml ....”开始解释 PHP 代码。您可以通过删除 apache conf 中的类似行来禁用 php 处理程序。
或者您可以在 php.ini< 中禁用
short_open_tags
/a>、vhost、htaccess 通过设置 php_flagYour server should be configured to treat html file as php.
The reason it is throwing a parse error should be because you use XHTML for your page, with an XML declaration which begins with
<?xml
If
short_open_tags
is set toon
, it could start interpreting PHP code with 'xml ....' on the first line.You can both disable php handler by removing a similar line in your apache conf.
or you can disable
short_open_tags
in your php.ini, vhost, htaccess by setting a php_flag网络服务器上文件的扩展名与该文件在后台实际发生的情况几乎没有关系。您可以配置一个网络服务器来提供“index.exe”,由 PHP 解析它,并输出为 HTML。
我不知道这个“iweb”业务,但是在 Apache 上,您可以使用单个指令轻松映射要由 PHP 解析的任何扩展:
The extension of a file on a webserver has very little to do with what actually happens in the background with that file. You could configure a webserver to serve up an "index.exe", have it parsed by PHP, and be output as HTML.
I don't know about about this 'iweb' business, but on Apache, you can trivially map any extension to be parsed by PHP with a single directive: