When writing content for your site, you typically store them in either html or php files. HTML files are created with markup tags and these files are not processed or parsed by the server. Php files, on the other hand, are parsed and processed by the server before being displayed in html format to the client browser. Php files can also automatically use HTML code, however html files do not have the ability to process php code by default. This ability can be accomplished, however, by altering the .htaccess file in your hosting account.

How to enable HTML files to display php code

  1. Log into your cPanel dashboard.
  2. Using the File Manager, navigate to the root folder for the domain you want to work with. Also, be sure you set the Show Hidden Files option as you will be working with the .htaccess file.
  3. Now that you are in the root folder for the domain, locate the .htaccess file. If there is not one for the domain, you will need to create a new one. Once created or found, edit the file by highlighting the it and clicking on the Edit icon from the toolbar at the top of the page.
    click edit icon
  4. This brings you to the cpanel file editor. You will want to insert the following line of code at the top of the .htaccess file.
    AddType application/x-httpd-php5 .html .htm .php
  5. Click on the Save Changes button located in the upper right-hand corner of the screen. You are now able to place php code sections into your html files and have them display. Look at the before and after shot to see how the code affects a page with php in it.
    Before After
    page before code change page after code change
Did you find this article helpful?

We value your feedback!

Why was this article not helpful? (Check all that apply)
The article is too difficult or too technical to follow.
There is a step or detail missing from the instructions.
The information is incorrect or out-of-date.
It does not resolve the question/problem I have.
How did you find this article?
Please tell us how we can improve this article:
Email Address

new! - Enter your name and email address above and we will post your feedback in the comments on this page!

Did you find this article helpful?

Post a Comment

Email Address:
Phone Number:

Please note: Your name and comment will be displayed, but we will not show your email address.

Related Questions

Here are a few questions related to this article that our customers have asked:
Ooops! It looks like there are no questions about this page.
Would you like to ask a question about this page? If so, click the button below!
Need More Help?

Help Center Search

Current Customers

Email: support@WebHostingHub.com Ticket: Submit a Support Ticket
Call: 877-595-4HUB (4482)
757-416-6627 (Intl.)
Chat: Click To Chat Now

Ask the Community

Get help with your questions from our community of like-minded hosting users and Web Hosting Hub Staff.

Not a Customer?

Get web hosting from a company that is here to help.