To make a .html file process as a . PHP file, We will have to make adjustments by adding a handler to the .htaccess file.

Create a .htaccess file at the root of the website and add this line:

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

Now the HTML file will be processed like a PHP file. Finally, embed PHP codes in the HTML file to verify that we successfully made the changes.

Follow the steps below to make a .html file process as a . PHP file.

Step1: Login in Cpanel.

Step2: Open File Manager from the Files section.

2293_blobid0.png?1665387463622

Step3: Click on Settings at the top-right corner, and then enable Show Hidden Files (dotfiles):

2295_blobid1.jpg?1665387463622

Step4: Locate the .htaccess file. If there is no such file, create it;

2294_blobid2.jpg?1665387463622

Step5: Select the .htaccess file, and click the right mouse button over it. Select Edit, and after you get a pop-up window, click on the button Edit again to confirm:

2296_blobid3.png?1665387463622

Step6: Add the following line inside the .htaccess file and save the file.

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

We are using PHP version 7.4 for the website; you should change the PHP version accordingly.

Was this answer helpful? 0 Users Found This Useful (1 Votes)