httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Markus Schiegl">
Subject mod_proxy_fcgi and php
Date Sat, 22 Apr 2006 21:33:43 GMT

i took some time and played with the latest mod_proxy_fcgi and PHP as
It even works somehow :-)

I use trunk on Solaris 10x86 and PHP 5.1.2 configured as fastcgi server.
PHP has been configured with "doc_root = /opt/www/html" and
"cgi.fix_pathinfo = 0"
Omitting these settings when accessing /opt/www/html/i.php gives:

"No input file specified."

According to truss PHP tried to stat some weird files
(e.g. proxy:balancer://phpfiles/i.php) finds nothing and *bang*
In the working case SCRIPT_FILENAME is set to e.g.
My simple php apps work nevertheless. 

relevant lines from httpd.conf...

<Proxy balancer://phpfiles>
         BalancerMember fcgi://localhost:8000

# according to the docs REQUEST_FILENAME should contain the full
# in this case its the same as REQUEST_URI (i.e. /i.php and not

#RewriteRule ^/(.*) balancer://phpfiles/$1
# tried to overwrite SCRIPT_FILENAME, rewrite.log confirms this, but it
didn't work ;-)
# RewriteRule ^/(.*) fcgi://localhost:8000/$1 [P]  # needs patch below
RewriteRule ^/(.*) balancer://phpfiles:8000/$1 [P]

error.log (Patch (1) applied and corresponding RewriteRule used)
mod_proxy_fcgi.c(88): proxy: FCGI: canonicalising URL
mod_proxy_fcgi.c(113): [client] proxy: FCGI: set
r->filename to proxy:fcgi://localhost:8000/i.php
mod_proxy_fcgi.c(118): [client] proxy: FCGI: set
r->path_info to /i.php
proxy_util.c(1397): [client] proxy: *: found reverse
proxy worker for fcgi://localhost:8000/i.php
mod_proxy.c(756): Running scheme fcgi handler (attempt 0)

>From my limited perspective r->filename should be set to
Any ideas?

While playing with mod_rewrite i realized it does not recognize fcgi as
scheme yet (1)
The following patch should solve this.

Index: httpd-trunk/modules/mappers/mod_rewrite.c
--- httpd-trunk/modules/mappers/mod_rewrite.c   (revision 396157)
+++ httpd-trunk/modules/mappers/mod_rewrite.c   (working copy)
@@ -577,6 +577,9 @@
         if (!strncasecmp(uri, "tp://", 5)) {        /* ftp://    */
             return 6;
+        if (!strncasecmp(uri, "cgi://", 6)) {       /* fcgi://    */
+            return 7;
+        }
     case 'g':

Markus Schiegl  |  |  7159881@ICQ | PGP-KeyID:

View raw message