Fredrik Tolf wrote:
Hi!
I've begun to be more and more displeased with Apache lately, so I've
been thinking of writing my own HTTP server instead. I still want PHP
support, but writing a new SAPI for PHP seems like overkill.
What's so bad about Apache?
Therefore, is it possible to use PHP from the command line, but still
enable some HTTP-server-only stuff, like GET and POST variables,
cookies, session management, file uploads, and so on? I haven't been
able to find any docs on doing that, but I'm thinking that it should be
possible.
No, not really. $_GET and $_POST are populated by PHP from information
from the HTTP request (which, obviously, isn't available in CLI mode).
In CLI, there is no concept of cookies, sessions (as there are in web
world), file uploads, etc. What you get is what you would recieve with
any CLI app, command line parameters, and access to the system calls
that you can execute using exec() and friends.
I'm not really sure why you want to write your own HTTP server, as this
has been done many times over the years. What exactly are your issues
with Apache?
So, can someone either point me to some docs in this, or, lacking such,
give me a short intro to it?
For a decent CLI script, you will need to access the command line
arguments, for which there is a great PHP class over at PEAR. There you
will also find classes for color output on the console and other classes
that you will find useful.
FWIW,
Burhan
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php