not executing embedded php commands

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John Smith

    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.ph p">
    <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 **
  • Michael Austin

    #2
    Re: not executing embedded php commands

    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.ph p">
    <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.ph p">
    <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>
    =============== ==============

    Comment

    Working...