Execution of HTML as PHP

To be able to handle php script in .html file , you need to add the following in the .htaccess file:

AddType application/x-httpd-php5.html

To check that the setup works you need to create the following .html file and add the following php code in it:


<html>
<head> </ head>
<body>
<? php echo "Hello world!";?>
</ body>
</ html>

Save the file named test.html and upload it to your web hosting account.

When writing the address http://domain.com/test.html in the browser you should see the message Hello World!

  • 268 Users Found This Useful
Was this answer helpful?

Related Articles

Can I use short tags in PHP scripts

Yes you can. The settings of PHP (short_open_tag) allow you to use short tags in PHP scripts.

Internal Server Error or Error 500

Internal Server ErrorThe server encountered an internal error or misconfiguration and was unable...

How to turn off register_globals in PHP

In each directory where you want register_global to be turned off, place the following php.ini...

Add your own php.ini file to the crontab command

If you want to use your own php.ini in the implementation of cronjobs, add the following to the...

How to increase PHP memory limit

If you like to increase the PHP memory limit in any folder you just create a file called php.ini....