PHP and mod_proxy_fcgi on Window
| From: | Jiri Tulach - Position | Date: | Fri, 07 Sep 2012 14:16:58 +0000 |
| Subject: | PHP and mod_proxy_fcgi on Window | ||
| Groups: | php.internals.win | ||
| Request: | Send a blank email to internals-win+get-902@lists.php.net to get a copy of this message | ||
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.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; }
--- 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; }