Re: mod_proxy_fcgi and php
On 5/13/06, Markus Schiegl <[EMAIL PROTECTED]> wrote: Because of r->uri == r->path_info, ap_add_cgi_vars sets SCRIPT_NAME to "" PHP needs this one for backreference and http://cgi-spec.golux.com states it must be set. An empty r->path_info (manually patched) would give me a SCRIPT_NAME but removes PATH_INFO, ergo no solution. Ideas? What do other fcgi implementations send? When in doubt, I imagine the best thing to do is whatever mod_fastcgi or mod_fcgid do. Each fcgi-request is logged (mod_proxy_fcgi.c, line 918) as error? What about replacing APLOG_ERR with APLOG_DEBUG? Done, along with changing a couple of APLOG_DEBUGs that are really errors to APLOG_ERR. -garrett
RE: mod_proxy_fcgi and php
On 10/05/06, Garrett Rooney wrote: My next round with mod_proxy_fcgi and PHP as backend... > Sorry it took me so long to get back to this. Got distracted > with other things, etc. dito. > > From my limited perspective r->filename should be set to > > "/opt/www/html/i.php" Any ideas? > > mod_proxy_fcgi is talking to an arbitrary socket that could > correspond to any file on disk, how would it figure out what > to set r->filename to? The more i think about this, the more i agree with you. speeking to a network connected backend and passing infos about local files (actually not needed) makes little sense. Other conclusion: there is no based security possible, hence i switched to based security. two more questions: Because of r->uri == r->path_info, ap_add_cgi_vars sets SCRIPT_NAME to "" PHP needs this one for backreference and http://cgi-spec.golux.com states it must be set. An empty r->path_info (manually patched) would give me a SCRIPT_NAME but removes PATH_INFO, ergo no solution. Ideas? Each fcgi-request is logged (mod_proxy_fcgi.c, line 918) as error? What about replacing APLOG_ERR with APLOG_DEBUG? > > While playing with mod_rewrite i realized it does not recognize fcgi > > as scheme yet (1) The following patch should solve this. ... > > I'll look at getting this checked in, thanks! thanks! -- Markus Schiegl | [EMAIL PROTECTED] | [EMAIL PROTECTED] | PGP-KeyID: 0x21063504
Re: mod_proxy_fcgi and php
On 4/22/06, Markus Schiegl <[EMAIL PROTECTED]> wrote: Sorry it took me so long to get back to this. Got distracted with other things, etc. From my limited perspective r->filename should be set to "/opt/www/html/i.php" Any ideas? mod_proxy_fcgi is talking to an arbitrary socket that could correspond to any file on disk, how would it figure out what to set r->filename to? The fact that PHP has settings you can tweak to make this work implies to me that it's not a problem we need to fix... 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; +} break; case 'g': I'll look at getting this checked in, thanks! -garrett
mod_proxy_fcgi and php
Hi, i took some time and played with the latest mod_proxy_fcgi and PHP as Backend. 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. "proxy:balancer://phpfiles/i.php" My simple php apps work nevertheless. relevant lines from httpd.conf... = BalancerMember fcgi://localhost:8000 RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} -f # according to the docs REQUEST_FILENAME should contain the full filename # in this case its the same as REQUEST_URI (i.e. /i.php and not /opt/www/html/i.php) RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} \.php$ #RewriteRule ^/(.*) balancer://phpfiles/$1 [E=SCRIPT_FILENAME:%{DOCUMENT_ROOT}%{REQUEST_FILENAME},P] # tried to overwrite SCRIPT_FILENAME, rewrite.log confirms this, but it didn't work ;-) # RewriteRule ^/(.*) fcgi://localhost:8000/$1 [P] # needs patch below (1) RewriteRule ^/(.*) balancer://phpfiles:8000/$1 [P] error.log (Patch (1) applied and corresponding RewriteRule used) == ... mod_proxy_fcgi.c(88): proxy: FCGI: canonicalising URL //localhost:8000/i.php mod_proxy_fcgi.c(113): [client 192.168.210.20] proxy: FCGI: set r->filename to proxy:fcgi://localhost:8000/i.php mod_proxy_fcgi.c(118): [client 192.168.210.20] proxy: FCGI: set r->path_info to /i.php proxy_util.c(1397): [client 192.168.210.20] 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 "/opt/www/html/i.php" 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; +} break; case 'g': -- Markus Schiegl | [EMAIL PROTECTED] | [EMAIL PROTECTED] | PGP-KeyID: 0x21063504