Page 1 of 1

problem using php in html

Posted: Wed Dec 10, 2008 11:15 am
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

Re: problem using php in html

Posted: Wed Dec 10, 2008 2:21 pm
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.

Re: problem using php in html

Posted: Fri Dec 12, 2008 9:25 am
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....

Re: problem using php in html

Posted: Fri Dec 12, 2008 10:17 am
by papa
Me too. Read tasairis comment one more time.

Hint:
Apache also needs to be set up to run PHP files.

Re: problem using php in html

Posted: Mon Dec 15, 2008 11:11 am
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

Re: problem using php in html

Posted: Mon Dec 15, 2008 12:25 pm
by kaisellgren
index.php

Code: Select all

<?php
exit;
echo 'PHP is not executing...';
?>
If you dont see anything, you are doing good.

Re: problem using php in html

Posted: Mon Dec 15, 2008 1:21 pm
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.

Re: problem using php in html

Posted: Mon Dec 15, 2008 2:06 pm
by popey
hello

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