开发者

Non PHP site generates PHP errors

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, th开发者_Go百科e 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.


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.


Your 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 to on, 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.

AddHandler php5-script .html

or you can disable short_open_tags in your php.ini, vhost, htaccess by setting a php_flag


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:

AddHandler php5-script .html
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜