How to include php in html
Posted by: n.morgana (---.baf.movistar.cl)
Date: December 05, 2014 05:23PM

Hi,

I simply would like to know whether there is a smarter solution to include php inside html files on wamp, without necessarily changing the .html extension to .php.
I've already tried changing the httpd.conf of apache by adding a new line in the mime_module:

"AddType Application/x-httpd-php .html .htm",

this solution did not work out well for me, since firefox keeps forcing me to open this file separately (with option "open with". Is there a cleaner solution like handling the .html file as .php?


I run wamp2.5 x64 on windows 8.1 with apache 2.4.10 and php 5.6.

Options: ReplyQuote
Re: How to include php in html
Posted by: RiggsFolly (---.as43234.net)
Date: December 06, 2014 01:15AM

As this is a non standard mechanism, the simplest way is to create a .htaccess file with these 2 command in, in the directories that it should apply to


AddHandler application/x-httpd-php .html
DirectoryIndex index.html index.php

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote


Sorry, only registered users may post in this forum.