Andreas Korthaus: php.exe POST und GET Daten übergeben

Beitrag lesen

Hi!

Z.B. findest Du da solche Dinge in der Datei cgi_main.c im Verzeichnis cgi in Zeile 983:

/* Make sure we detect we are a cgi - a bit redundancy here,
    but the default case is that we have to check only the first one. */
if (getenv("SERVER_SOFTWARE")
  || getenv("SERVER_NAME")
  || getenv("GATEWAY_INTERFACE")
  || getenv("REQUEST_METHOD")) {
  cgi = 1;
}

In Zeile 569 dieser Datei(Pfad im Source: sapi/cgi/cgi_main.c) steht übrigens auch noch ein interessanter Kommentar:

/* {{{ init_request_info

initializes request_info structure

specificly in this section we handle proper translations
  for:

PATH_INFO
 derived from the portion of the URI path following
 the script name but preceding any query data
 may be empty

PATH_TRANSLATED
    derived by taking any path-info component of the
 request URI and performing any virtual-to-physical
 translation appropriate to map it onto the server's
 document repository structure

empty if PATH_INFO is empty

The env var PATH_TRANSLATED **IS DIFFERENT** than the
 request_info.path_translated variable, the latter should
 match SCRIPT_FILENAME instead.

SCRIPT_NAME
    set to a URL path that could identify the CGI script
 rather than the interpreter.  PHP_SELF is set to this.

REQUEST_URI
    uri section following the domain:port part of a URI

SCRIPT_FILENAME
    The virtual-to-physical translation of SCRIPT_NAME (as per
 PATH_TRANSLATED)

These settings are documented at
  http://cgi-spec.golux.com/

Based on the following URL request:

http://localhost/info.php/test?a=b

should produce, which btw is the same as if
  we were running under mod_cgi on apache (ie. not
  using ScriptAlias directives):

PATH_INFO=/test
  PATH_TRANSLATED=/docroot/test
  SCRIPT_NAME=/info.php
  REQUEST_URI=/info.php/test?a=b
  SCRIPT_FILENAME=/docroot/info.php
  QUERY_STRING=a=b

but what we get is (cgi/mod_fastcgi under apache):

PATH_INFO=/info.php/test
  PATH_TRANSLATED=/docroot/info.php/test
  SCRIPT_NAME=/php/php-cgi  (from the Action setting I suppose)
  REQUEST_URI=/info.php/test?a=b
  SCRIPT_FILENAME=/path/to/php/bin/php-cgi  (Action setting translated)
  QUERY_STRING=a=b

Comments in the code below refer to using the above URL in a request

*/

Grüße
Andreas