Re: [PHP] php as CGI and $_POST
David T-G wrote: Peter -- ...and then Peter Risdon said... % % David T-G wrote: % % > bash-2.05a$ /usr/local/bin/php -v % > PHP 4.3.4 (cli) (built: Jan 6 2004 15:27:52) % % You probably need the cgi version - not the command line one you % actually have. Ooohhh... Ouch. So there are *three* possible PHP compiles: module, CGI, and CLI? So far as the php binary in /usr/local/bin is concerned there are two - cli and cgi. The module consists of different files (see the AddModule and LoadModule bits of httpd.conf). You can have both (I have made that my standard build for multi-homed machines) but need to muck about a bit for this. OK. To save us the cost of rebuilding at this host, is there any way to pass args to the CLI version of the script running as a CGI? You might find you start getting odd problems with http headers if you use the cli version. In general you're better off using the cgi one. But you can get this by recompiling but not installing php cgi, then copy the php executable to, say, /usr/local/bin/php-cgi and prefacing your scripts with this in the shebang. That would mean zero disruption for users on the machine. Peter. Thanks & HAND :-D -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php as CGI and $_POST
Curt, et al -- ...and then Curt Zirzow said... % % * Thus wrote David T-G ([EMAIL PROTECTED]): % > % > bash-2.05a$ /usr/local/bin/php -v % > PHP 4.3.4 (cli) (built: Jan 6 2004 15:27:52) % % that cli should be cgi. % % I'm assuming you compiled php with something like: %configure --with-apxs=/yada/apxs [other options] Yep. And with CLI enabled, too. % % What you need to do is recompile php with configure like: %configure --[other options] Gotcha. Thanks for the pointers. % % Then make will build a cgi binary in sapi/cgi/php, relative to your build % directory. If you want both versions (cgi and cli) you'll have to % manually place the cgi version of php somewhere else than % /usr/local/bin or name it something php_cgi. And then reference % that file in you php script. I found where our support crew had built the current version not quite six months ago, and that a lovely buildme file with our approximately 8 billion --with* params in it, so I just copied the tree, pulled apxs out, rebuilt, and copied the CGI php somewhere as you suggest. And now I have post data; yippee :-) Thanks also for your other response. Finding the build tree was definitely the easier route :-) HAND :-D -- David T-G [EMAIL PROTECTED] http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgpJXoqkHNGmw.pgp Description: PGP signature
Re: [PHP] php as CGI and $_POST
* Thus wrote David T-G ([EMAIL PROTECTED]): > Peter -- > > ...and then Peter Risdon said... > % > % David T-G wrote: > % > % > bash-2.05a$ /usr/local/bin/php -v > % > PHP 4.3.4 (cli) (built: Jan 6 2004 15:27:52) > % > % You probably need the cgi version - not the command line one you > % actually have. > > Ooohhh... Ouch. So there are *three* possible PHP compiles: > module, CGI, and CLI? > > OK. To save us the cost of rebuilding at this host, is there any way to > pass args to the CLI version of the script running as a CGI? You might have getenv('QUERY_STRING') for GET data and *possibly* to get the POST data you can do something like: $fp = fopen('php://stdin', 'r'); while (!feof($fp) ) $buf .= fgets($fp, 1024); fclose($fp); Then of course you're going to have to parse the query_string and post data in order to get the variable names and values.. parse_str(getenv('QUERY_STRING'), $_GET); Curt -- "I used to think I was indecisive, but now I'm not so sure." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php as CGI and $_POST
Peter -- ...and then Peter Risdon said... % % David T-G wrote: % % > bash-2.05a$ /usr/local/bin/php -v % > PHP 4.3.4 (cli) (built: Jan 6 2004 15:27:52) % % You probably need the cgi version - not the command line one you % actually have. Ooohhh... Ouch. So there are *three* possible PHP compiles: module, CGI, and CLI? OK. To save us the cost of rebuilding at this host, is there any way to pass args to the CLI version of the script running as a CGI? Thanks & HAND :-D -- David T-G [EMAIL PROTECTED] http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgphoH93CTsi6.pgp Description: PGP signature
Re: [PHP] php as CGI and $_POST
* Thus wrote David T-G ([EMAIL PROTECTED]): > Curt, et al -- > > ...and then Curt Zirzow said... > % > % * Thus wrote David T-G ([EMAIL PROTECTED]): > % > > % > My code is as simple as > % > > % > #!/usr/local/bin/php > % > % What does '/usr/local/bin/php -v' show? > > Doesn't seem to scary to me: > > bash-2.05a$ /usr/local/bin/php -v > PHP 4.3.4 (cli) (built: Jan 6 2004 15:27:52) that cli should be cgi. I'm assuming you compiled php with something like: configure --with-apxs=/yada/apxs [other options] What you need to do is recompile php with configure like: configure --[other options] Then make will build a cgi binary in sapi/cgi/php, relative to your build directory. If you want both versions (cgi and cli) you'll have to manually place the cgi version of php somewhere else than /usr/local/bin or name it something php_cgi. And then reference that file in you php script. Curt -- "I used to think I was indecisive, but now I'm not so sure." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php as CGI and $_POST
David T-G wrote: Curt, et al -- ...and then Curt Zirzow said... % % * Thus wrote David T-G ([EMAIL PROTECTED]): % > % > My code is as simple as % > % > #!/usr/local/bin/php % % What does '/usr/local/bin/php -v' show? Doesn't seem to scary to me: bash-2.05a$ /usr/local/bin/php -v PHP 4.3.4 (cli) (built: Jan 6 2004 15:27:52) You probably need the cgi version - not the command line one you actually have. Peter. Copyright (c) 1997-2003 The PHP Group Zend Engine v1.3.0, Copyright (c) 1998-2003 Zend Technologies % % % Curt TIA & HAND :-D -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php as CGI and $_POST
Curt, et al -- ...and then Curt Zirzow said... % % * Thus wrote David T-G ([EMAIL PROTECTED]): % > % > My code is as simple as % > % > #!/usr/local/bin/php % % What does '/usr/local/bin/php -v' show? Doesn't seem to scary to me: bash-2.05a$ /usr/local/bin/php -v PHP 4.3.4 (cli) (built: Jan 6 2004 15:27:52) Copyright (c) 1997-2003 The PHP Group Zend Engine v1.3.0, Copyright (c) 1998-2003 Zend Technologies % % % Curt TIA & HAND :-D -- David T-G [EMAIL PROTECTED] http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp1qcksBNrfz.pgp Description: PGP signature
Re: [PHP] php as CGI and $_POST
* Thus wrote David T-G ([EMAIL PROTECTED]): > > 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 What does '/usr/local/bin/php -v' show? Curt -- "I used to think I was indecisive, but now I'm not so sure." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php