1

I've been beating myself up trying to get my php parse inside my html. I have used the following in my .htaccess to no avail.

AddType application/x-httpd-php .html - a dialog box pops up asking me to open a php file
AddType application/x-httpd-php5 .html - Same
AddHandler application/x-httpd-php .html - Same
AddHandler php-script .html - just doesnt parse but looking into the source code you can see the php
AddHandler php5-script .html - Same

I would like to point out as well that a normal .php file runs fine on the server.

What gives?

1
  • Are you adding this in a htaccess file or apache httpd.conf? Commented Dec 2, 2012 at 19:34

2 Answers 2

1

You have to change your server configuration. Go into your httpd.conf or .htaccess and change this line (or something close to it):

addtype application/x-httpd-php .php

to parse .html files like this:

addtype application/x-httpd-php .php .html

and then restart the server

Sign up to request clarification or add additional context in comments.

Comments

0

Nevermind, figured it out. It has something to do with my doctype. short_open_tag is enabled so php is trying to parse because it thinks its php.

Solution:

Need to print that particular line with proper php syntax

<?php echo "<?xml version=\"1.0\" encoding=\"UTF-8\"; ?> ?>

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.