0

I searched already all the day for a solution to execute PHP files in a HTML file.

I use a CMS based on PHP. This CMS uses a Design template System where the Design has to be in a index.htm File. When renaming this file to index.php - it don't run (tested).

I am designing a new Clanpage and want to insert a "serverviewer".

This one is in a PHP file and does this:

Link to picture

I used this to call the php file:

  <div style="width: 280px; height 90px; float: left;margin-right: 10px; margin-bottom: 15px;" >
    <?php include("http://www.this-is-war.com/tiw/include/designs/TiWlog/sv/sv_01.php"); ?>
  </div>

but unfortunately php-code in a HTML file is not parsed, and I get no Serverviewer.

What can I do to execute a PHP statement in a HTML file without renaming the file to a .php extension?

3
  • <iframe src="http://stuff/stuff.php"></iframe>? Commented May 5, 2013 at 16:12
  • 2
    If you are able to modify your apache and php config files, you can change it so apache reads .htm files as php Commented May 5, 2013 at 16:13
  • use htaccess to modify php to html Commented May 5, 2013 at 16:15

2 Answers 2

1

Add this line either to apache conf file or .htaccess file so php can execute html file

 AddType application/x-httpd-php .html
Sign up to request clarification or add additional context in comments.

2 Comments

In general, if a question is a duplicate, it's best just to cast a close vote rather than answering it again. If more detail is required on the 'canonical page' for this question, by all means do add it there.
its not a duplicate ... my second question here @stackoverflow. I tried AddType application/x-httpd-php .html - but without success .. the php is not displayed. I created a .htaccess file in the directory where the htm File is and put "AddType application/x-httpd-php .html" as only command in. Using the Ifram works .. but this is not a really good way to program .. why AddType brings no change on my webspace ?
0

A easy solution for this is to use an iframe

<div style="width: 280px; height 90px; float: left;margin-right: 10px; margin-bottom: 15px;" >
<iframe src="http://www.this-is-war.com/tiw/include/designs/TiWlog/sv/sv_01.php"></iframe>
</div>

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.