1

Embedding HTML within .PHP files is one of the primary functionalities of PHP, but is it possible to do it the other way round?

I mean, embedding PHP tags, , within a .HTML document?? Is this sort of coding possible?

Any suggestions welcome.

3
  • Similar: stackoverflow.com/questions/1581765/… Commented Mar 26, 2010 at 17:20
  • What about if wampserver is the current, offline server? Is there a similar file to edit? Commented Mar 26, 2010 at 17:39
  • With Wampserver and apache on Windows, find file httpd.conf and add line AddType application/x-httpd-php .html You can now mix PHP tags within your .HTML files. Commented Mar 26, 2010 at 18:29

3 Answers 3

1

Add this to your .htaccess file and HTML files will be handled like PHP files allowing you put PHP in HTML files.

AddType application/x-httpd-php .html

Some more information on it here

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

Comments

1

If you configure your server properly you can put php code in almost any kind of file.

Comments

1

If you are using apache, just add this line in the httpd.conf file

"AddType application/x-httpd-php .html"

Now you can embed php tags in .html files and they will be parsed correctly

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.