On Wed, Feb 23, 2005 at 11:22:59PM -0800, Brion Vibber wrote:
Edward Peschko wrote:
a couple of questions - what are the prerequisites
for running
'index.php' at the command line, eg:
php index.php
doesn't seem to do anything.
Ultimately, I'd like to be able to run index.php sans browser and be
able to debug based on the output that comes to standard out...
MediaWiki's index.php is the web entry point and is not designed to be
run from the command line. You'll see no output because it's trying to
use an HTTP header to redirect you to the main page; the header is not
output by PHP's command-line mode.
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?
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.
and have php
print out all the associated class variables and
object variables.
So far as I know, PHP doesn't have metaclasses or class variables.
well, I mis-spoke. I wanted to print out an object, and it so happens
that the object I chose (WebRequest) doesn't seem to have any object
variables *or* class variables.
Ed
(
ps -
ok, preemptive apology for the following rant, but this is
seriously screwed up:
"As of PHP 4.3.0, the name, location and existence of the CLI/CGI
binaries will differ depending on how PHP is installed on your
system. By default when executing make, both the CGI and CLI ere
built and placed as sapi/cgi/php and sapi/cli/php, and NOTE THAT
BOTH ARE NAMED PHP."
It goes on to say that based on what compile options you use, ONE OR
THE OTHER php is installed as php, and the other is ignored.
I have a php CLI version, but I guess the wiki I installed works
because I've got a:
LoadModule php5_module libexec/libphp5.so
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??
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?
)