Very impressive work! As for writing to the php-cgi.exe I suggest you look into proc_open() function in PHP 4.3.0 (http://www.php.net/manual/en/function.proc-open.php).
Edin ----- Original Message ----- From: "Dominik Wittenbeck" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, January 07, 2003 10:28 PM Subject: Building a HTTP server using PHP -> PHP and Windows question (please don't delete) 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: [EMAIL PROTECTED] URL: http://www.developaz.com -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php