Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Non PHP site generates PHP errors

Tags:

php

parsing

iweb

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.

like image 246
YsoL8 Avatar asked Apr 27 '10 20:04

YsoL8


Video Answer


2 Answers

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.

like image 144
Eric Petroelje Avatar answered Oct 07 '22 16:10

Eric Petroelje


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

like image 26
Boris Guéry Avatar answered Oct 07 '22 14:10

Boris Guéry