problem using php in html

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
popey
Forum Newbie
Posts: 6
Joined: Sat Dec 06, 2008 2:44 pm

problem using php in html

Post by popey »

hello,
i am trying php in html and getting following problem...

code:
<h3>hello!</h3>
<?php
echo "<p>in php</p>";
?>
<p>out of php</p>

Output:
hello!
in php
"; ?>
out of php

why i am getting "; ?>...code is in htdocs with .php extention....i am currently using windows notepad...plz also guide me which editor should i use DreamWeaver or PDT or any other?...rest php and apache are working well
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: problem using php in html

Post by requinix »

For some reason PHP isn't executing that file.
The file should be somewhere in Apache's web files: probably the htdocs folder. Apache also needs to be set up to run PHP files.
popey
Forum Newbie
Posts: 6
Joined: Sat Dec 06, 2008 2:44 pm

Re: problem using php in html

Post by popey »

hello
i edit my code to
<h3>hello!</h3>
<?php while(1); ?>
<?php echo "<p>in php</p>";
?>
<p>out of php</p>

but i am getting same output with "; ?>......my code is in apache htdocs folder....i think there is some configuration problem....
User avatar
papa
Forum Regular
Posts: 958
Joined: Wed Aug 27, 2008 3:36 am
Location: Sweden/Sthlm

Re: problem using php in html

Post by papa »

Me too. Read tasairis comment one more time.

Hint:
Apache also needs to be set up to run PHP files.
popey
Forum Newbie
Posts: 6
Joined: Sat Dec 06, 2008 2:44 pm

Re: problem using php in html

Post by popey »

hello
i am still not able to find the problem....when i am including PHPIniDir "c:/php" in apache conf file it is not starting....if i am using following code , without making above entry, i am not getting any output...the codes that i posted previously are also without this entry in apache conf file
code:
<?php
$like = "I like php but";
print $like;
$num = 12345;
print $num;
?>
please tell me the problem....what is the problem in configuration file if any...plz help
User avatar
kaisellgren
DevNet Resident
Posts: 1675
Joined: Sat Jan 07, 2006 5:52 am
Location: Lahti, Finland.

Re: problem using php in html

Post by kaisellgren »

index.php

Code: Select all

<?php
exit;
echo 'PHP is not executing...';
?>
If you dont see anything, you are doing good.
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: problem using php in html

Post by califdon »

Try this:

Code: Select all

<?php echo phpinfo(); ?>
This should produce a very long list of settings for PHP. If it doesn't work, PHP isn't running and you need to carefully go through your Apache configuration (httpd.conf) as well as PHP configuration (php.ini) to determine what's wrong. There are lots of references online as to what needs to be in each of those files.
popey
Forum Newbie
Posts: 6
Joined: Sat Dec 06, 2008 2:44 pm

Re: problem using php in html

Post by popey »

hello

my problem has been solved .....actually i did a small mistake ...thanks u all for helping
Post Reply