0

My index.html file

<html> 
    <head>
        <title> PHP inside HTML </title>
    </head>
    <body>
        <h1>
            <?php
                  echo "PHP Output";
            ?>
        </h1>
        <h1>
            <p>
                HTML Output
            </p>
        </h1>
    </body>
</html>

My Expected output of the above code:

PHP Output
HTML Output

I have tried with below combinations but none of these helps me get the output.

AddHandler application/x-httpd-php56 .shtml .html .htm
AddHandler server-parsed .shtml .shtm .htm .html
AddHandler x-httpd-php .html .htm
AddHandler application/x-httpd-php5 .html .htm

2nd Set of Codes Not Working

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

3rd Set of Codes Not Working.

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

While adding the Mime types using the .htaccess.

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

It leads to download the files instead of working.

Returns Internal Server Error

Options +ExecCGIenter
AddHandler fcgid-script .html
FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .html

Please help me to resolve this issue.

I have referred the page in stack-overflow but all of the codes are not working for me. StackOverFlow

Community
  • 1
  • 1
Vasanth
  • 3
  • 3
  • Possible duplicate of [Using .htaccess to make all .html pages to run as .php files?](http://stackoverflow.com/questions/4687208/using-htaccess-to-make-all-html-pages-to-run-as-php-files) – Syfer Mar 07 '17 at 23:29

1 Answers1

0

If your account's under Cloudlinux based server then use the below code, Hope it will work fine.

Code

AddHandler application/x-httpd-ea-php56 .htm .html .shtml

AddType application/x-httpd-php5 .php

Consider the PHP versions and modify the code accordingly.

Community
  • 1
  • 1
Thamil
  • 16