PHP not working in HTML (new install)
Posted by: we5inelgr (
Date: July 06, 2021 11:55PM

Hi All,

I just installed WAMP v 64 bits on my Windows 10 PRO laptop for the first time. I do not have IIS turned on as a Windows feature.

I'm trying to execute php code within an .html file. However, I can't get php to echo anything out.

File name extensions are shown, so I know it's an HTML (.html) file.

I modified my Apache .httpd.conf file like this (added the last line) and restarted all services:
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

I also changed my www folder by removing the default path in httpd-vhosts.conf (and restarted all services):

DocumentRoot "C:/Homepage"
<Directory "C:/Homepage/">

I have a file called index.html in that folder C:\Homepage\index.html with only these three lines in it:

<? echo "PHP"; ?>

I have "short_open_tag" checked in the PHP setting of WAMP.

When I access that page in MS Edge Version 91.0.864.59 (Official build) (64-bit), all I see is "PRE" and "POST" printed on the page, but not "PHP"

If I only put this in that html file

<? phpinfo(); ?>

Nothing is displayed as well.

Any ideas why I can't get php to execute in an html file?


UPDATE - Nevermind smiling smiley I wasn't accessing the page via localhost/index.html

Edited 1 time(s). Last edit at 07/07/2021 12:16AM by we5inelgr.

Options: ReplyQuote
Re: PHP not working in HTML (new install)
Posted by: Otomatic (Moderator)
Date: July 07, 2021 09:02AM

The files must have the .php extension

Wampserver 3.2.6 32 bit - Apache 2.4.49 - PHP 8.0.9…5.6.40 - MySQL 5.7.35 - MariaDB 10.5.12/10.6.4
Wampserver 3.2.6 64 bit - Apache 2.4.49 - PHP 8.0.9…5.6.40 - MySQL 5.7.35/8.0.26 - MariaDB 10.5.12/10.6.4
PhPMyadmin 5.1.1 - MysqlDumper 1.24.5
on W10 and W7 Pro 64 bit
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons
« Ce n'est pas parce qu'ils sont nombreux à avoir tort, qu'ils ont forcément raison. Coluche »
« It's not because they are many to be wrong, they are necessarily right. Coluche »

Edited 1 time(s). Last edit at 07/07/2021 11:08AM by Otomatic.

Options: ReplyQuote

Sorry, only registered users may post in this forum.