How to Run HTML Files as PHP Scripts

You can run files with an .html (or other) extension in PHP by creating or modifying an .htaccess file in the same folder as the HTML file. The .htaccess file should include the following line, depending on your current setup:

For sites using our Web Hosting, Cloud or Dedicated product with CloudLinux and EA4/LSAPI:

AddHandler application/x-httpd-lsphp .htm .html .shtml

For sites using our Web Hosting, Cloud or Dedicated product without CloudLinux or with EA3/suPHP:

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

You can also add other extensions at the end of this line, separated by a space, if you need them. With this configuration, .html and .htm files can also include PHP code.

 

  • 0 Kunder som kunne bruge dette svar
Hjalp dette svar dig?

Relaterede artikler

[Advanced] Script for File Upload onto Server

The following PHP script allows you to transfer files to the server by using a web form....

How to Change PHP Version

By default, your account will run on the default "native" version of PHP installed on our...

Increase PHP Upload Limit (or any other PHP setting)

By default, your PHP scripts hosted on Solutionz-eweb servers will use the PHP settings we have...

Powered by WHMCompleteSolution