Building a HTTP server using PHP -> PHP and Windows question (please don't delete)
| From: | Dominik Wittenbeck | Date: | Tue, 07 Jan 2003 21:28:26 +0000 |
| Subject: | Building a HTTP server using PHP -> PHP and Windows question (please don't delete) | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-14829@lists.php.net to get a copy of this message | ||
Hi,
I am not trying to spam you guys, I just don't know where else to turn to to get help. Maybe
you know somebody to help me on the following Win2K/PHP problem.
Task: I am trying to implement the CGI interface on a PHP based webserver I have built using the new
CLI, that comes with PHP 4.3.0. So far I have no problems with the server sending and recieving data
as well as static document. However I am experiencing difficulties, trying to implement the CGI
interface.
In order stabalize the server I have the server process PHP files via the php.exe (the CGI not the
CLI one that comes with the 4.3.0). I use
shell_exec("php\php-cgi.exe -c php\php.ini PathToPhpScript.php");
to call the binary and have a custom script processed. Before this I set environmental variables
using putenv(). All this works fine. I get my html output, the headers and stuff and send it back to
the browser.
I am however experiencing problems, when trying to get the php-cgi.exe to read POST data, that
supposedly has to be submitted via the "standard input" if no other mechanism is
available. Now unlike GET, which basically comes from the QUERY_STRING env-var, I appearently cannot
"abuse" another env-var such as HTTP_RAW_POST_DATA for POST payload. Trying to pipe
information either directly or via a file like
shell_exec("type fileWithPostData | php\php-cgi.exe -c php\php.ini PathToPhpScript.php");
or
shell_exec("echo postData | php\php-cgi.exe -c php\php.ini PathToPhpScript.php");
doesn't work. How do I get the php-cgi.exe to understand and process my POST data? There has to
be a way, as other webserver have to use the same interface. I just cannot figure out how. As this
is the last step to complete the implementation of the CGI on my server, I desperately need help!
I am currently using a bugfix that populates the HTTP_RAW_POST_DATA var and append a PHP script
before each script to be processed, that analyses the variables from it and fills it into $_POST...
which still does not help me with uploaded files :-( ... I know, this workaround sucks pretty bad
too!
If you are interested in the source: http://developaz.no-ip.com/index.php?action=download(9)
Thanks very much in advance!
Dominik Wittenbeck
----------------------------------------------------------------
System Architect
Developaz Network
Holderbaum Str. 31
67549 Worms
Telefon: 06241/209474
Mobil: 0179/7710426
E-Mail: webmaster@developaz.com
URL: http://www.developaz.com