note 102084 added to install.unix.commandline
| From: | forrest-php at mibsoftware dot com | Date: | Wed, 26 Jan 2011 15:00:22 +0000 |
| Subject: | note 102084 added to install.unix.commandline | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-176348@lists.php.net to get a copy of this message | ||
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.
----
Server IP: 69.147.83.197
Probable Submitter: 208.111.222.188
----
Manual Page -- http://www.php.net/manual/en/install.unix.commandline.php
Edit -- https://master.php.net/note/edit/102084
Del: integrated -- https://master.php.net/note/delete/102084/integrated
Del: useless -- https://master.php.net/note/delete/102084/useless
Del: bad code -- https://master.php.net/note/delete/102084/bad+code
Del: spam -- https://master.php.net/note/delete/102084/spam
Del: non-english -- https://master.php.net/note/delete/102084/non-english
Del: in docs -- https://master.php.net/note/delete/102084/in+docs
Del: other reasons-- https://master.php.net/note/delete/102084
Reject -- https://master.php.net/note/reject/102084
Search -- https://master.php.net/manage/user-notes.php