I am writing a Java web server and right now I am able to service .HTML files fine, but I am having a hard time figuring out how to handle .PHP files which require $_POST and $_GET.
How do web servers usually fill these arrays? There is no way to fill them using the command-line from what I can tell since I was originally thinking to pipe the stdout of an exec("php whatever.php some $_get args), but that's not possible without physically changing the php code to exploding the args and filling them into $_GET which I don't want to do -- I want to do it the way web servers do it.
Does anyone have suggestions of how web servers do things like this?
preguntado el 28 de agosto de 11 a las 02:08
You can use interface with PHP via Interfaz de Entrada Común (CGI), which boils down to setting up a bunch of environment variables and then invoking PHP.
The CGI protocol is defined in RFC 3875.