note 102084 deleted from install.unix.commandline by joey

From: Date: Wed, 28 Dec 2011 08:55:21 +0000
Subject: note 102084 deleted from install.unix.commandline by joey
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-185263@lists.php.net to get a copy of this message
Note Submitter: forrest-php at mibsoftware dot com ---- Getting php-cgi to work as CGI in my home-grown HTTP server took some experimentation. (The error messages were not helpful, to put it mildly. And a lot of web searches returned results about how to configure Apache. For me php.exe from the command line worked easily, so it was frustrating to feel like I was always so close.) After some lengthy experimentation, I got it to work recently. exec php-cgi.exe with the environment as follows for PHP 5.3. (Programming your own http server requires getting stdin and stdout to work properly in addition, but I don't need to describe that here.) CONTENT_LENGTH=0 CONTENT_TYPE=application/x-www-form-urlencoded DOCUMENT_ROOT=/pubwww QUERY_STRING=op=ini&d=12345 REDIRECT_STATUS=200 REQUEST_METHOD=GET REQUEST_URI=/inbox/ini-20110124.php SCRIPT_FILENAME=c:/pubwww/inbox/ini-20110124.php SCRIPT_NAME=/inbox/ini-20110124.php SERVER_NAME=localhost SERVER_PROTOCOL=HTTP/1.0 SERVER_SOFTWARE=hserve 20040610 SystemRoot=C:\WINDOWS (SystemRoot is needed to keep PDO ODBC happy on Windows.) Another tip for Windows users: ^ is the escape character to set an environment variable with SET. E.g. set QUERY_STRING=op=ini^&d=12345 If your scripts need further CGI environment variables, you should set them also, but PHP will start and run the script with these.

« previous php.notes (#185263) next »