How can I parse html as php?

Create an .htaccess file and upload it to the root of your public_html directory. Include the following lines...

 

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

 

This code will tell Apache to treat all .html and .htm files as PHP files. This means that any time a user requests a .html or .htm file, Apache will first parse the file as PHP and then execute it.

Because these extensions will be processed as PHP with the above command, changing the permission on those file types to 755 may be necessary.

If the above line does not work use the following:

 

AddType application/x-httpd-php5 .php5 .php4 .php .php3 .php2 .phtml .html .htm


or

 

AddType application/x-httpd-php .php5 .php4 .php .php3 .php2 .phtml .html .htm



If using CloudLinux lsapi /LiteSpeed API, use the following:

AddType application/x-httpd-lsphp .php5 .php4 .php .php3 .php2 .phtml .html .htm
AddHandler application/x-httpd-lsphp .php5 .php4 .php .php3 .php2 .phtml .html .htm


You should only parse HTML files that you trust. If you parse an HTML file that contains malicious code, it could be executed on your server.
You should make sure that the PHP code in your HTML files is well-written and secure. If the code is not well-written, it could be vulnerable to security attacks.

Ultra is an amazing hosting company with award winning support. If your hosting provider does not allow parsing HTML as PHP then we recommend checking out our hosting plans...

https://www.ultrawebhosting.com/shared-web-hosting

 

We can move your website over to our services free of cost.

 

  • 527 Users Found This Useful

Was this answer helpful?

Related Articles

The MySQL server is currently offline admin bin Cpanel/cpmysql/DBCACHE: exit 11

The error message...  The MySQL server is currently offline admin bin Cpanel/cpmysql/DBCACHE:...

PHP information

To view your current version of PHP you will create a php file, for example info.php, and place...

What is the path to PHP?

The path to PHP on Ultra Web Hosting is /usr/bin/php.  Ultra runs many different versions of PHP...

What is the Path to ImageMagick?

The path to ImageMagick on Ultra Web Hosting is /usr/bin/. This means that you can access...

How can I view/modify data in my MySQL database?

There are two ways to view your MySQL database with Ultra Web Hosting: Using phpMyAdmin Go...