Picnic Website Code Tutorials

Run PHP With HTML Extensions in Wamp Tutorial

How in the heck do you run php (includes or other) within an html page (AKA with .html extensions) while testing locally with Wamp? I looked and looked for this answer. Once you find right keywords to search for there seem to be quite a few different solutions. None seemed to work until I ran across a forum post. Below is the most simplist way to do it!

Left click on the Wamp icon in the bottom right tray of your computer >> Apache >> left click on httpd.conf >> scroll 2/3rd's the way down >> add AddType application/x-httpd-php .html to <IfModule mime_module></IfModule> as shown below >> save and close it >> restart Wamp >> Done!

<IfModule mime_module>
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php .php3
    AddType application/x-httpd-php .html

Additionally, if you want to setup a virtual directory (AKA Alias), in other words you want to point wamp at your development files instead of moving them into the Wamp www. directory follow this tut.

Additionally 2, relative links (eg images/yada.jpg) in php includes wont work outside the root level when setting it up with the above method (AKA Alias). So if you need to use absolute path links (eg /images/yada.jpg) in php includes, then you need to set up a Virtual Host instead by following this tut.

Need help adding this or other code to your website? Post it here in the forum! Forum


Top Donators

Friends of Mine