Jump to content

Configure IIS7 to run php within html


speedy_rudolf

Recommended Posts

Hi. I'm fairly new to server management, so bear with me (and sory for my english). I'm have successfuly installed and configured Windows Web Server 2008 R2 and PHP 5.3.5 (I know it works because I can run *.php files/scripts just fine), but I have one problem. It doesn't run php scripts within *.html files. Let's consider the following code:

<html>
<head><title>TITLE</title></head>
<body>
<?php echo("Hello ");?>
world!
</body>
</html>

The output to the above code is:

<?php echo("Hello ");?> world!

Does anyone know how to solve this problem? Thank you in advance. Bye.

Link to comment
https://forums.phpfreaks.com/topic/227376-configure-iis7-to-run-php-within-html/
Share on other sites

Are you using IIS or Apache? If you are using IIS, it is probably configured so that PHP handles only pages that end with the .php extension. If your page above is named someName.html, IIS won't know that PHP should handle the page. Not sure if Apache works similarly. My suggestion: try naming your page with .php extension and see what happens.

 

Hope that helps.

 

-Brian

Yes, I am using IIS.

I have tried naming it *.php, that just gives me a "500" error.

As for the configuration, how can I configure it so it also handles scripts within html? (I haven't tried inserting a handler for html, but I guess it would also give me the "500" error.)

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.