Edward Peschko wrote:
On Wed, Feb 23, 2005 at 11:22:59PM -0800, Brion Vibber wrote:
If you want to run the web output from a command line, you should use a PHP CGI executable and set up the CGI environment variables.
so I get these environmental variables from what - the $_ENV and $_SERVER globals? Php seems to have sliced the environmental variables into these two associative arrays.. What if I need the variables in $_COOKIE and $_GET and $_POST?
If you google I'm sure you can find lots of documentation on how CGI works. CGI (Common Gateway Protocol) is the classic standard way for web servers to send request information to programs, which then return some HTTP header lines, a blank, and the resulting data to send back to the client. The web server gives request information to the CGI program by means of environment variables.
PHP can operate in a web server either as a built-in module (eg mod_php in Apache) or as a CGI program, in which case it will interpret the CGI environment variables and present data to the script in $_GET, $_POST, $_COOKIE, $_SERVER, etc.
There are numerous command-line entry points in the maintenance subdirectory, mostly special-purpose. eval.php provides a somewhat primitive interactive PHP interpreter within the active MediaWiki code environment. (You really, really want PHP compiled with readline support or this will be painful. :)
I'll give it a whirl, but I'm skeptical. I just tried it, got a '>' as a prompt, hit one question mark (to get help) and it seemed to spawn an infinite loop of '>' prompts.
"?" is not a valid PHP statement.
[snip]
statement inside of my httpd.conf, but this is just too whacked out. They've bifurcated the php code base whether or not your in a command line world or a CGI world??
No, there's a single code base; they just chose some unfortunate naming for the front-end executables.
Just curious, but why was php chosen in the first place? The more I look, the more php seems to be tied together with little bits of string and glue.. why not python or mod_perl, or ruby? Or, even c/C++, or *shudder* java?
Why anything? You have to pick something, and somebody's going to bitch about it whatever it is. Perl in particular is twice as ugly as PHP. ;)
-- brion vibber (brion @ pobox.com)