PHP and mod_proxy_fcgi on Window

[email protected] (Jiri Tulach - Position)
Newsgroups php.internals.win
Message-ID <[email protected]>
Hello,
I found a problem with mod_proxy_fcgi on Windows when SCRIPT_PATH 
contains full path with drive letter.

Imagine this Apache configuration:

ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:300/C:/Scripts/test/$1

Unfortunately this is translated as:

/C:/Scripts/test/somescript.php

which is not a valid file.

I made a simple patch to sapi/fpm/fpm/fpm_main.c which detects absolute 
path with drive letter. If found it strips leading slash.

I want to share this with PHP community - see attachment.

Best Regards

Jiri Tulach
fpm_main.diff (text/plain, 425 B)
--- fpm_main.c.orig	pá 9  7 15:24:34 2012
+++ fpm_main.c	pá 9  7 15:27:43 2012
@@ -1106,6 +1106,7 @@
 				/* Copy path portion in place to avoid memory leak.  Note
 				 * that this also affects what script_path_translated points
 				 * to. */
+				if((p[1])&&(p[2]==':')) p++; /* Fix Windows drive letters /C:/Scripts/ -> C:/Scripts */
 				memmove(env_script_filename, p, strlen(p) + 1);
 				apache_was_here = 1;
 			}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.