Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

PHP5 & Apache2 - action = php5_script help required

GothmordrinGothmordrin Posts: 10Member
Hi Group!
Newbie PHP5 enthusiast here.

Running Apache2 and PHP5 on SuSE Linux 9.1 pro.

Can't configure Apache2 and PHP5 correctly to implement the "noddy" form feedback example using "POST" example.

HTML Form page is:


Name:

Email:



Simple enough!

"foo.php" is:

<?php
echo $_POST['username'] . "<br>";
echo $_POST['email'] . "
";
?>

Hardly mind-blowing!

However! Instead of EXECUTING foo.php and displaying the contents of the input form, the server actually serves the script as a web-page. (i.e. I see the above code in the output!).

I feel that I've got a config error with Apache2 but - being a newbie - it could be with PHP5 instead.

Please could a resident PHP5 guru kick my butt and tell me (gently please!) where I've gone wrong?

Thanks in advance!

Gothmordrin.
Think it through first - then pester someone.

Comments

  • homerocdahomerocda Posts: 87Member
    Hello, have you done all the instructions the install.txt file on your php base directory tell you do do?

    Looks like Apache doesn't recognize .php files as scripting files. Add these lines on your apache httpd.conf file:

    #load the php module
    LoadModule php5_module "/path/to/php/php5apache2.so" (or something like that, actually I use windows, but i belive the module names won't change)
    AddType application/x-httpd-php .php

    #Path to php.ini
    PHPIniDir "/path/to/php"

    : Hi Group!
    : Newbie PHP5 enthusiast here.
    :
    : Running Apache2 and PHP5 on SuSE Linux 9.1 pro.
    :
    : Can't configure Apache2 and PHP5 correctly to implement the "noddy" form feedback example using "POST" example.
    :
    : HTML Form page is:
    :
    :
    : Name:

    : Email:

    :
    :
    : Simple enough!
    :
    : "foo.php" is:
    :
    : <?php
    : echo $_POST['username'] . "";
    : echo $_POST['email'] . "";
    : ?>
    :
    : Hardly mind-blowing!
    :
    : However! Instead of EXECUTING foo.php and displaying the contents of the input form, the server actually serves the script as a web-page. (i.e. I see the above code in the output!).
    :
    : I feel that I've got a config error with Apache2 but - being a newbie - it could be with PHP5 instead.
    :
    : Please could a resident PHP5 guru kick my butt and tell me (gently please!) where I've gone wrong?
    :
    : Thanks in advance!
    :
    : Gothmordrin.
    : Think it through first - then pester someone.
    :

  • GothmordrinGothmordrin Posts: 10Member
    Thanks for this Homerocda.

    That sounds like it's the problem!
    I knew it had to be something really simple but the source-code install documrntation assumes quite a bit of prior knowledge - which I don't yet have.

    I'll fix the ini script nows.

    Regards,

    Gothmordrin.
    Think it through first - then pester someone.

  • GothmordrinGothmordrin Posts: 10Member
    Hi again Homerocda!

    I've been through my Apache and PHP setups and basically there isn't an install or setup text file in either of them. There is also not a php5???.so under extensions in PHP either.

    However! I'm now getting the gist of what's happening so I think I can take it from here. My guess is that I haven't told PHP to create a script-able runtime module at configure time and/or also that I haven't told Apache what the scriptable PHP runtime module is.

    PHP does, however, work for non-CGI stuff.
    (i.e. <? php echo "Hello World" ?> works correctly!) It's just handling the output of GET and POST that seems to be failing!

    I'll have a ferkle on the web sites for each of them (bookmarked and heavily used!) and see if I can see what I've done wrong.

    Thanks again for your help.

    Gothmordrin
    Think it through first - then pester someone.

  • GothmordrinGothmordrin Posts: 10Member
    Problem solved thanks Homerocda!

    Part of my troubles lay in the fact that the Posix default setup is slightly different to 99% of what is cited on the Web - which tends to focus on IIS under Windoze.

    Found the file, modded it - now it all works.

    Case closed.

    Many thanks again.

    Gothmordrin.
    Think it through first - then pester someone.

Sign In or Register to comment.