Jump to content

How to enable PHP in HTML page


Recommended Posts

Hi,

 

I am using windows, Apache2.2 and PHP 5.1.

I have no problems accessing a php or html page using the http path to the files, for example executing , http://localhost:8080/example.html , whic has php code inside

 

But what i want to be able to do is to opent the "example.html " with my IE browser and get the right result. However, when I do this , I get a blank page.

 

I did put the following line in my httpd.conf to enable php code to be executed inside html pages:

 

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

 

I aslo tried the following line:

 

AddHandler application/x-httpd-php .htm .html

 

 

Yet, none of this helped.

 

I don't know where else to look for to get this working.

 

Does anyone know the answer?

 

-malena

 

 

Link to comment
Share on other sites

You should just add the .html file extension to the AddType not the AddHandler

 

When you added the .html extension to the AddType you did restart Apache? Also what type of PHP tag are you using in example.html? IS it <?php ?>, or <? ?> or something else?

 

Make sure you use the full tags, eg <?php ?>, <?php echo "blah"; ?> rather than the short hand versions <? ?> or <?= ?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.