470,632 Members | 1,983 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,632 developers. It's quick & easy.

not executing embedded php commands

I just installed Apache 2.2 and PHP 5.2.6 on an XP machine. I created a
test.php file which contains only one function, phpinfo(). It ran fine.
I saw the php parameters.

I then tested it using an htm file (see code below). When I clicked on
the submit button, instead of calling test.php, IE displayed a file
download window and asked me whether I wanted to open or save test.php.
And the hello world page (see code below) was blank.

What am I doing wrong? Thanks.

p.s. I have the following line in the httpd.conf file

AddType application/x-httpd-php .htm

============================
<html>
<body>

<FORM METHOD=post ACTION="test.php">
<INPUT type="text" size="10">
<input type="Submit" VALUE="Submit">
</FORM>

</body></html>

======= Hello World =====================
<html>
<head>
<titleHello World </title>
</head>
<body>
<?php

echo 'Hello, world!';

?>
</body>
</html>
** Posted from http://www.teranews.com **
Jul 9 '08 #1
1 1143
John Smith wrote:
I just installed Apache 2.2 and PHP 5.2.6 on an XP machine. I created a
test.php file which contains only one function, phpinfo(). It ran fine.
I saw the php parameters.

I then tested it using an htm file (see code below). When I clicked on
the submit button, instead of calling test.php, IE displayed a file
download window and asked me whether I wanted to open or save test.php.
And the hello world page (see code below) was blank.

What am I doing wrong? Thanks.

p.s. I have the following line in the httpd.conf file

AddType application/x-httpd-php .htm

============================
<html>
<body>

<FORM METHOD=post ACTION="test.php">
<INPUT type="text" size="10">
<input type="Submit" VALUE="Submit">
</FORM>

</body></html>

======= Hello World =====================
<html>
<head>
<titleHello World </title>
</head>
<body>
<?php

echo 'Hello, world!';

?>
</body>
</html>
** Posted from http://www.teranews.com **

Did you configure PHP in Apache?

there is a php module and addType that must be included - my system uses
as mod_php.conf that includes lines similar to:

AddType application/x-httpd-php .php .phtml .html .htm
AddType application/x-httpd-php-source .phps

[and this will be different for Windows/Linux]
LoadModule php?_module modules/mod_php_apache-2_0.exe
works for me - minor mods to show it does function..

====================
<html>
<body>

<FORM METHOD=post ACTION="test.php">
<INPUT name=var1 type=text size="10">
<input type="Submit" VALUE="Submit">
</FORM>

</body></html>
=====================
<html>
<head>
<titleHello World </title>
</head>
<body>
<?php

echo 'Hello, world!<br>';
echo $_POST['var1'];

?>
</body>
</html>
=============================
OUTPUT:
=============================
Hello, world!
test

[page source]
<html>
<head>
<titleHello World </title>
</head>
<body>
Hello, world!<br>test</body>
</html>
=============================
Jul 9 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Simon Hawkins | last post: by
26 posts views Thread by jini us | last post: by
4 posts views Thread by Justine | last post: by
2 posts views Thread by Pratibha | last post: by
59 posts views Thread by Jeff Bowden | last post: by
reply views Thread by Phas0r | last post: by
2 posts views Thread by Mark | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.