HTLM without PHP support

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
tazz
Forum Newbie
Posts: 2
Joined: Wed Apr 21, 2004 8:10 pm

HTLM without PHP support

Post by tazz »

The next code doesn´t work:

<html>
<body>
<?php
$myvar = "Hello PHP World! \n";
echo $myvar;
?>
</body>
</html>


Please Help me
Thanks :wink:
Unipus
Forum Contributor
Posts: 409
Joined: Tue Aug 26, 2003 2:06 pm
Location: Los Angeles, CA

Post by Unipus »

Well if you don't have PHP, why would you expect PHP code to work?
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

Unipus wrote:Well if you don't have PHP, why would you expect PHP code to work?
dont u know money and php support grows on trees....
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

.html files aren't processed by default. You have to enable it on whatever server you are using if you really want it.
tazz
Forum Newbie
Posts: 2
Joined: Wed Apr 21, 2004 8:10 pm

Post by tazz »

yes, I have PHP installed, on linux 7.3 and apache 2.0
the code before view is in .html file
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

k in your conf file there's a line similar to this:

Code: Select all

AddType application/x-httpd-php .php
adding .html and whatever other file formats you want php to process there should take care of it.
magicrobotmonkey
Forum Regular
Posts: 888
Joined: Sun Mar 21, 2004 1:09 pm
Location: Cambridge, MA

Post by magicrobotmonkey »

or I think the more standard (and hopefully more clear in the long run) approach would be to save the file as a .php file. There's no reason to go confusing everything by processing .html files as php (usually, ok so there might be occasionaly a reason to do that, but it'd better be a darned good one)
d3ad1ysp0rk
Forum Donator
Posts: 1661
Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA

Post by d3ad1ysp0rk »

Only reason to parse .html as .php: If you have over 20 pages linked together WITHOUT a good system of navigation (ie. Includes, iframes, etc, anything where links can be changed on only one page but effects the whole site). Then it becomes a nightmare to change every page to link to a .php instead of .html, but besides that, it's easier to do just that, switch them to .php..
magicrobotmonkey
Forum Regular
Posts: 888
Joined: Sun Mar 21, 2004 1:09 pm
Location: Cambridge, MA

Post by magicrobotmonkey »

mmm.. that's not darned good enough! but i know what you mean - i had to take over administrating a poorly designed (static) site and they would ask me to like "add a tab" something they thought was small and easily done and it would take me hours of opening, pasting, and closing the stupid things... That's why I'm redoing it all using php, and css and charging a lot!
Post Reply