How to Open HTML files as PHP – Dedicated Server and Shared Hosting Solution

By | May 29, 2013

Sometimes you might need to include PHP code into HTML pages. For example, you want to include a menu, that is called via PHP in a static HTML page and you cannot rename your files into PHP for many reasons. I will tell you how to do this on a dedicated server and on a shared hosting account.

If you’re leasing a server, you need to edit your httpd.conf file. It is usually located at /etc/httpd/conf (if you have any non-standard server configuration – ask your server provider about the location). All you need to do is just to ass the following line to the bottom of the file:

AddHandler application/x-httpd-php .phtml

This line will tell your server to treat HTML files as PHP ones. If you are on a shared hosting, you should try to add the same line to your .htaccess file. But it is not convenient if you need to do this for entire account with multiple domains. In order to make it working on a shared hosting, you need to add a new MIME type (95% hosting service providers allow this). I will show you on a Netfirms account, but this can be done almost anywhere. You should contact your hosting provider and ask where you can modify MIME associations. Ok, let’s start with Netfirms.

Let’s go to the Control Panel


Scroll down to Additional tools->.htaccess editor.


Choose MIME Types


Add the line just as shown on my screen. You’re done.

One thought on “How to Open HTML files as PHP – Dedicated Server and Shared Hosting Solution

  1. ronaldIrova

    Краска масляная 5 литров спонсорская помощь.У нас также есть раздел с гимнастическим и атлетическим оборудованием для улицы.

    Для изготовления игровых и спортивных комплексов мы используем инновационное оборудование, позволяющее реализовать самые разнообразные конструктивные решения, но с учетом общепринятых стандартов и образцов.Гладиаторская сетка – это конструкция, представляющая собой прямоугольный деревянный каркас, в котором заплетена сетка из полипропиленовой цветной веревки.


Leave a Reply

Your email address will not be published. Required fields are marked *