Quantcast
Channel: WampServer - WampServer English
Viewing all articles
Browse latest Browse all 3177

PHP not working in HTML (new install) (no replies)

$
0
0
Hi All,

I just installed WAMP v 3.2.3.3 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:

PRE<P>
<? echo "PHP"; ?>
<p>POST

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?

Thanks.



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

Viewing all articles
Browse latest Browse all 3177

Trending Articles