1 (edited by jeckel 2016-06-12 08:07:02)

Topic: How to Parse PHP 7 in HTML Files

I have been banging my head against a wall for the past couple hours trying to get my site to parse PHP inside my html files.

In the cPanel I changed my PHP version to 7.0.7 and the phpinfo() call works in my test.php file, but it doesn't work in my index.html file. When I show source on the index.html file, the php code is there as red text and the error tooltip says, "Saw <?. Probable cause: Attempt to use an XML processing instruction in HTML."

I have tried various htaccess AddHandler and AddType lines, and none of them seem to do the trick. I'm assuming that I am missing something.

Is there some option I have to set in the cPanel? If not, what is the htaccess code I have to add?

Re: How to Parse PHP 7 in HTML Files

After filling a help desk ticket, an excellent support staffer was able to help me with my issue.

For anyone coming across the same issue, the answer is to add the line 'AddType application/x-httpd-lsphp .html' to the htaccess file. smile

Re: How to Parse PHP 7 in HTML Files

We are glad You have received support regarding this issue! Thank You for sharing the solution to our community!

Re: How to Parse PHP 7 in HTML Files

I have been working on this issue myself for the past couple of days, thanks for the response with the fix!

Re: How to Parse PHP 7 in HTML Files

Unfortunately, I can not help you! I'm not good at this. Sorry!((
abk