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
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.
:
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.
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.
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.