svn commit: trunk/busybox/networking

landley at busybox.net landley at busybox.net
Thu Sep 1 09:38:34 UTC 2005


Author: landley
Date: 2005-09-01 02:38:32 -0700 (Thu, 01 Sep 2005)
New Revision: 11309

Log:
Tracking system but #4: php needs the environment variable SCRIPT_FILENAME.


Modified:
   trunk/busybox/networking/httpd.c


Changeset:
Modified: trunk/busybox/networking/httpd.c
===================================================================
--- trunk/busybox/networking/httpd.c	2005-09-01 03:11:19 UTC (rev 11308)
+++ trunk/busybox/networking/httpd.c	2005-09-01 09:38:32 UTC (rev 11309)
@@ -1146,6 +1146,11 @@
       }
       if(script != NULL)
 	*script = '\0';         /* reduce /PATH_INFO */
+       /* SCRIPT_FILENAME required by PHP in CGI mode */
+       if(realpath(purl + 1, realpath_buff))
+         addEnv("SCRIPT", "FILENAME", realpath_buff);
+       else
+         *realpath_buff = 0;
       /* set SCRIPT_NAME as full path: /cgi-bin/dirs/script.cgi */
       addEnv("SCRIPT_NAME",    "",         purl);
       addEnv("QUERY_STRING",   "",         config->query);
@@ -1178,7 +1183,7 @@
 	/* set execve argp[0] without path */
       argp[0] = strrchr( purl, '/' ) + 1;
 	/* but script argp[0] must have absolute path and chdiring to this */
-      if(realpath(purl + 1, realpath_buff) != NULL) {
+      if(*realpath_buff) {
 	    script = strrchr(realpath_buff, '/');
 	    if(script) {
 		*script = '\0';




More information about the busybox-cvs mailing list