Jump to content

[SOLVED] <?php ?> in html doen not work


leprkhn

Recommended Posts

i installed debian etch on my computer and set up apache2 php5 and mysql on it. everything seems to be working fine except that any php that i place into html file doesn't show up. i put the php inbetween <?php ?> tags. i even tried <script language="php"> </script> tags, and it still doesn't work. im pretty new to php and linux but im a fast learner.

if anyone could help me out a bit i'd really appreciate it.

is there some .conf file i have to edit?

is it a php problem or an apache problem?

 

thanks

leprkhn

Link to comment
https://forums.phpfreaks.com/topic/61442-solved-in-html-doen-not-work/
Share on other sites

I'm not familiar with debian etch. I use XAMPP. But, before those tags can work you typically have to place the files in a specific directory on your computer. For XAMPP it's Program Files/XAMPP/htdocs, for example. This may not be the case with your debian etch, though.

ok...

my document root for apache is /var/www/ and thats where 'localhost' in my browser will go to.

inside /var/www/ i have index.html and test.php

test.php contains:

 

<?

echo ("hello");

$_one=1;

$_two=2;

$_three=($_one+$_two);

print($_three);

?>

 

and when the browser is pointed at localhost/test.php it returns hello3. like it should.

 

however.

 

index.html contains:

<html>

<head><title>blah</title></head>

<body>

<p>blah blah blah </p>

<?php

echo ("hello?");

print ("hello?");

?>

</body>

</html>

 

and when the browser is pointed at localhost/index.html it returns:

 

blah blah blah

 

 

 

... and thats it. none of the php gets shown. i dont even know if it's being parsed or just skipped.

 

 

thoughts?

<?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.