Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:2349 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 81594 invoked from network); 16 Jun 2003 17:42:28 -0000 Received: from unknown (HELO nox.cx) (216.12.18.14) by pb1.pair.com with SMTP; 16 Jun 2003 17:42:28 -0000 Received: (qmail 25853 invoked by uid 1000); 16 Jun 2003 17:42:49 -0000 Message-ID: <20030616174249.25852.qmail@nox.cx> Date: Mon, 16 Jun 2003 13:42:49 -0400 To: internals@lists.php.net Mail-Followup-To: internals@lists.php.net Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="cWoXeonUoKmBZSoM" Content-Disposition: inline Subject: Patch: No input file specified From: zakj-php-internals@nox.cx (Zak Johnson) --cWoXeonUoKmBZSoM Content-Type: text/plain; charset=us-ascii Content-Disposition: inline I run PHP via a simple-minded webserver which sets up some environment variables and then calls my php scripts (which begin with a "#!/usr/local/bin/php" line). My scripts must handle all the headers, including the HTTP status header. My standard included file contains "header($_SERVER['SERVER_PROTOCOL'] . ' 200 OK');", and other files may emit a similar header with a different status code for redirection and so forth. Unfortunately, after upgrading to 4.3.2 I encountered two problems. First, PHP was refusing to emit status headers for which the status code was 200 even when explicity instructed to by the above header() call. Second, while my scripts would run correctly at the command line, when run via a web server I was getting a 404 status and the error message "No input file specified." I have created a patch to work around the above problems; it is a hack, but restores my desired functionality if I also set "cgi.rfc2616_headers = 1" in php.ini. Please consider backing out rev 1.195 of php4/sapi/cgi/cgi_main.c or adding a configuration directive to disable its behaviour. I'm not sure what the correct solution for the "No input file specified" problem is; I'll try to look into it more if I have some time next week, but this was my first peek at PHP's source. -Zak --cWoXeonUoKmBZSoM Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="php-4.3.2-cgi.patch" --- sapi/cgi/cgi_main.c.orig Mon May 26 19:21:08 2003 +++ sapi/cgi/cgi_main.c Fri Jun 13 13:11:58 2003 @@ -279,7 +279,7 @@ rfc2616_headers = 0; } - if (SG(sapi_headers).http_response_code != 200) { + /* if (SG(sapi_headers).http_response_code != 200) */ { int len; if (rfc2616_headers) { @@ -959,12 +959,14 @@ #endif /* 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; } + */ #if PHP_FASTCGI } #endif --cWoXeonUoKmBZSoM--