0

I have a file "index.html". And a code into it

<?php echo "Hello world"; ?>

But in browser I can see:

<!--<?php echo "Hello world"; ?>-->

I use Microsoft-IIS/7.5server, so I cant use .htaccess file.

5
  • Try <?php //echo "Hello world"; ?> Commented May 25, 2016 at 13:03
  • 8
    rename your file to index.php. Commented May 25, 2016 at 13:03
  • If I rename - all works good. But I need .html extension Commented May 25, 2016 at 13:06
  • Why do you need .html? It won't work in a .html file because it's not HTML. Commented May 25, 2016 at 13:08
  • stackoverflow.com/questions/2791326/… may have some information Commented May 25, 2016 at 13:20

3 Answers 3

5

Save your file as index.php instead. HTML doesn't read PHP.

Edit: Try to change the home url then. Check this out:

https://www.iis.net/configreference/system.webserver/defaultdocument

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

Comments

0

You can store your file with .php extension and user rewrite module in iis to link .html file to .php file that you store. commonly for SEO Using this method.

Comments

-2
  1. // This is a one-line c++ style commenting

Example

<?php
// This is a single line commment.
$comment = 1;

/* This is a multi line comment
       yet another line of comment */
$comment = "many lines";

?>

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.