not seeing php output in html files
Posted by: wamp_newbie (---.west.biz.rr.com)
Date: June 27, 2007 01:24AM

hello,

I have a new wamp 1.7.2 install on WinXP Prof and all runs fine except when I load a .html page that contains php script -- the expected php output is not there. I can load and run .php files fine and they display as expected, no issues, so I know php is working well. I even installed drupal under this wamp install and it works perfectly as well. Normal .htm and .html files work fine without any php scripts in them. The issue is php inside .htm or .html files appears to not be parsed/processed.

I'm using the standard httpd.conf file and changed nothing from the default install other then enabling gd2 extensions in the php.ini file.

In the example "test.html" file below in the c:/wamp/www directory, I simply get a blank screen. (running it from the same pc going to [localhost])

*************************
<html>
<head>
<title>Test</title>
</head>
<body>
<?php
print ("Hello test"winking smiley;
?>
</body>
</html>
*************************

When I look at the source from IE, it shows the above exactly.

When I browse to a .php file such "test.php" below (http://localhost/test.php), my browser displays what I expect (i.e. "Hello test"winking smiley.

*************************
<?php
print ("Hello test"winking smiley;
?>
*************************

Please excuse the dumb question, but is there a simple config change I need to apply to make php scripts parse from inside .html files or am I fundamentally missing something? I am very new at php programming.

thanks!

Options: ReplyQuote
Re: not seeing php output in html files
Posted by: krusher_00 (---.accessplus.com.au)
Date: June 27, 2007 09:12AM

Not really a guru on that myself, but I'd assume that if its a .html file then it wouldn't pass through the .php interpreter and therefore just come out as php code in a html file.

Make sense to you?

Apache should by default load index.html or index.php if it can find one of them

Options: ReplyQuote
Re: not seeing php output in html files
Posted by: wamp_newbie (---.west.biz.rr.com)
Date: June 27, 2007 03:18PM

Thank you! I was assuming I could leave the files named .html... now I realize the files should stay named as .php but leave all the normal html code in them. I fundamentally missed this. Sorry for the dumb post. thanks again



Post Edited (06-27-07 15:56)

Options: ReplyQuote
Re: not seeing php output in html files
Posted by: blckspder (---.bestweb.net)
Date: June 27, 2007 03:58PM

If your looking for php to work with .html files look into SMARTY, it can be found at [smarty.php.net]. it allows you to keep the .html extension and still use PHP with it.

Options: ReplyQuote
Re: not seeing php output in html files
Posted by: wamp_newbie (---.west.biz.rr.com)
Date: June 27, 2007 04:09PM

things are beginning to clear up for me... A LOT. thanks krusher and blckspder.

Options: ReplyQuote
Re: not seeing php output in html files
Posted by: krusher_00 (---.accessplus.com.au)
Date: June 28, 2007 01:06AM

Most welcome ;-)

Options: ReplyQuote


Sorry, only registered users may post in this forum.