php as CGI and $_POST
| From: | David T-G | Date: | Fri, 04 Jun 2004 13:08:11 +0000 |
| Subject: | php as CGI and $_POST | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-187620@lists.php.net to get a copy of this message | ||
Hi, all --
I am working up a CGI script to take advantage of Apache's suEXEC so that
the web server can manipulate files as the site owner. I have already
managed a simple
$f = fopen("/path/to/docroot/testfile",'w') ;
fwrite($f,"hi!\n") ;
fclose($f) ;
and know that it works as intended, but now I seem completely unable to
get any $_POST (or even $_GET) data into the script. I suspect, from
reading the manual and noting the warnings, that any GET data will be
ignored, and that's fine, but I know that I can provide that without even
messing about with a form that I might somehow be screwing up, so I
thought I'd try it...
My code is as simple as
#!/usr/local/bin/php
<?php
print "Content-type: text/html\n\n" ;
print "_POST IS ." ; print_r($_POST) ; print ".<br>\n" ;
print "_GET IS ." ; print_r($_GET) ; print ".<br>\n" ;
print "Enter your password:<br>\n" ;
print "<form method='post'>\n" ;
print "<input type='password' name='pass'>\n" ;
print "<br>\n<input type='submit' value='ENTER'>\n" ;
print "</form>\n" ;
exit ;
?>
but I only get
_POST IS .Array ( ) .
_GET IS .Array ( ) .
Enter your password:
____________________
ENTER
even after submitting. Switching to
<form method='get'>
doesn't help anything.
So how on earth does one get data into a CGI PHP script?
TIA & HAND
:-D
--
David T-G
davidtg@justpickone.org
http://justpickone.org/davidtg/ Shpx gur
Pbzzhavpngvbaf Qrprapl Npg!