Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Apache: Dev

mod_rewrite and mod_fcgid pass wrong fcgi request

 

 

Apache dev RSS feed   Index | Next | Previous | View Threaded


falcacibar at gmail

Nov 12, 2009, 3:25 PM

Post #1 of 11 (1504 views)
Permalink
mod_rewrite and mod_fcgid pass wrong fcgi request

Hi, i was friyng my brain the whole day trying to use a mod_rewrite
simple rewrite to a php pathinfo running via mod_fcgid.

http://domain.tld/path/info/use -> http://domain.tld/index.php/path/info/use

i trying so much posibilities, but when i take a strace to a php-fcgi
application i found the surprise that php treats to open the file

redirect:/index.php/path/info/use

i cannot know if this behavior is a problem in mod_rewrite or mod_fcgid.
someone can guide me with this?

--
Felipe Alcacibar Buccioni
Desarrollo y asesoria en sistemas y soluciones en
tecnologías de la información y comunicación.

--
i am using
Gentoo Linux,
mod_fcgid-2.3.4 (the source unpatched from the offical apache site)
apache 2.2.11

rohan www # apache2 -V
Server version: Apache/2.2.11 (Unix)
Server built: Nov 10 2009 17:59:53
Server's Module Magic Number: 20051115:21
Server loaded: APR 1.3.8, APR-Util 1.3.9
Compiled using: APR 1.3.8, APR-Util 1.3.9
Architecture: 32-bit
Server MPM: Worker
threaded: yes (fixed thread count)
forked: yes (variable process count)
Server compiled with....
-D APACHE_MPM_DIR="server/mpm/worker"
-D APR_HAS_SENDFILE
-D APR_HAS_MMAP
-D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
-D APR_USE_SYSVSEM_SERIALIZE
-D APR_USE_PTHREAD_SERIALIZE
-D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
-D APR_HAS_OTHER_CHILD
-D AP_HAVE_RELIABLE_PIPED_LOGS
-D DYNAMIC_MODULE_LIMIT=128
-D HTTPD_ROOT="/usr"
-D SUEXEC_BIN="/usr/sbin/suexec"
-D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
-D DEFAULT_ERRORLOG="logs/error_log"
-D AP_TYPES_CONFIG_FILE="/etc/apache2/mime.types"
-D SERVER_CONFIG_FILE="/etc/apache2/httpd.conf"


falcacibar at gmail

Nov 13, 2009, 4:31 PM

Post #2 of 11 (1455 views)
Permalink
Re: mod_rewrite and mod_fcgid pass wrong fcgi request [In reply to]

i was commented that in the wrong list? i saw this list in the
mod_fcgid's page and for that reason i posted that here, but i don't
know if this is a bug or feature or anyelse, or what is the module
that may be wrong. someone can tell me if i wrong please?

this is a nice list for the comments that i readed, congrats!

cheers!
--
Felipe Alcacibar Buccioni


On Thu, Nov 12, 2009 at 8:25 PM, Felipe Alcacibar <falcacibar [at] gmail> wrote:
> Hi, i was friyng my brain the whole day trying to use a mod_rewrite
> simple rewrite to a php pathinfo running via mod_fcgid.
>
> http://domain.tld/path/info/use -> http://domain.tld/index.php/path/info/use
>
> i trying so much posibilities, but when i take a strace to a php-fcgi
> application i found the surprise that php treats to open the file
>
> redirect:/index.php/path/info/use
>
> i cannot know if this behavior is a problem in mod_rewrite or mod_fcgid.
> someone can guide me with this?
>
> --
> Felipe Alcacibar Buccioni
> Desarrollo y asesoria en sistemas y soluciones en
> tecnologías de la información y comunicación.
>
> --
> i am using
> Gentoo Linux,
> mod_fcgid-2.3.4 (the source unpatched from the offical apache site)
> apache 2.2.11
>
> rohan www # apache2 -V
> Server version: Apache/2.2.11 (Unix)
> Server built:   Nov 10 2009 17:59:53
> Server's Module Magic Number: 20051115:21
> Server loaded:  APR 1.3.8, APR-Util 1.3.9
> Compiled using: APR 1.3.8, APR-Util 1.3.9
> Architecture:   32-bit
> Server MPM:     Worker
>  threaded:     yes (fixed thread count)
>    forked:     yes (variable process count)
> Server compiled with....
>  -D APACHE_MPM_DIR="server/mpm/worker"
>  -D APR_HAS_SENDFILE
>  -D APR_HAS_MMAP
>  -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
>  -D APR_USE_SYSVSEM_SERIALIZE
>  -D APR_USE_PTHREAD_SERIALIZE
>  -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
>  -D APR_HAS_OTHER_CHILD
>  -D AP_HAVE_RELIABLE_PIPED_LOGS
>  -D DYNAMIC_MODULE_LIMIT=128
>  -D HTTPD_ROOT="/usr"
>  -D SUEXEC_BIN="/usr/sbin/suexec"
>  -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
>  -D DEFAULT_ERRORLOG="logs/error_log"
>  -D AP_TYPES_CONFIG_FILE="/etc/apache2/mime.types"
>  -D SERVER_CONFIG_FILE="/etc/apache2/httpd.conf"
>


trawick at gmail

Nov 13, 2009, 5:49 PM

Post #3 of 11 (1460 views)
Permalink
Re: mod_rewrite and mod_fcgid pass wrong fcgi request [In reply to]

On Fri, Nov 13, 2009 at 7:31 PM, Felipe Alcacibar <falcacibar [at] gmail> wrote:
> i was commented that in the wrong list? i saw this list in the
> mod_fcgid's page and for that reason i posted that here, but i don't
> know if this is a bug or feature or anyelse, or what is the module
> that may be wrong. someone can tell me if i wrong please?

in the long term users [at] http is a better list for likely configuration
issues like this; we've been pointing mod_fcgid to this dev@ list
because mod_fcgid is new to this community and perhaps very few people
have used it


>
> this is a nice list for the comments that i readed, congrats!
>
> cheers!
> --
> Felipe Alcacibar Buccioni
>
>
> On Thu, Nov 12, 2009 at 8:25 PM, Felipe Alcacibar <falcacibar [at] gmail> wrote:
>> Hi, i was friyng my brain the whole day trying to use a mod_rewrite
>> simple rewrite to a php pathinfo running via mod_fcgid.
>>
>> http://domain.tld/path/info/use -> http://domain.tld/index.php/path/info/use
>>
>> i trying so much posibilities, but when i take a strace to a php-fcgi
>> application i found the surprise that php treats to open the file
>>
>> redirect:/index.php/path/info/use
>>
>> i cannot know if this behavior is a problem in mod_rewrite or mod_fcgid.
>> someone can guide me with this?

I don't know what your rewrite config is, but rewrite isn't required
to use path info. Can you post a minimal config that illustrates the
problem?

Something to consider when debugging mod_fcgid issues is that the same
config should work with mod_cgi[d] simply by changing the handler from
fcgid-script to cgi-script. More people on the users@ mailing list
are able to help with mod_cgi config issues.


falcacibar at gmail

Nov 14, 2009, 11:56 AM

Post #4 of 11 (1437 views)
Permalink
Re: mod_rewrite and mod_fcgid pass wrong fcgi request [In reply to]

Thanks Jeff for the response.

>
> I don't know what your rewrite config is, but rewrite isn't required
> to use path info.  Can you post a minimal config that illustrates the
> problem?
>

my current configuration of the mod_rewrite and mod_fcgid
rohan counter # cat /hosting/http/fullplanet.cl/dom/servicio/www/.htaccess
RewriteEngine on

RewriteCond $1 !^($|index\.php|stock|images|subidas|galerias|css|js|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
rohan counter # cat /hosting/http/fullplanet.cl/dom/servicio/www/.htaccess
RewriteEngine on

RewriteCond $1 !^($|index\.php|stock|images|subidas|galerias|css|js|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
--

rohan counter # cat /etc/apache2/modules.d/20_mod_fcgid.conf
<IfDefine FCGID>
LoadModule fcgid_module modules/mod_fcgid.so
FcgidIPCDir /var/run/fcgidsock
FcgidProcessTableFile /var/run/fcgid_shm

FcgidMaxRequestsPerProcess 8
FcgidMaxProcesses 10240
FcgidMaxProcessesPerClass 1024
FcgidMinProcessesPerClass 1
FcgidFixPathinfo 1

AddHandler fcgid-script .php
FcgidWrapper /usr/bin/php-cgi .php

FcgidInitialEnv PHP_FCGI_CHILDREN "8"
FcgidInitialEnv PHP_FCGI_MAX_REQUESTS "1"

<FilesMatch \.php$>
Options +ExecCGI
</FilesMatch>

DirectoryIndex index.php
</IfDefine>

i using a 307 redirect temporally, but that is the configuration that
give me this problem.

as i told before the file that try to open php-cgi is prefixed with
"redirect:" string.

> Something to consider when debugging mod_fcgid issues is that the same
> config should work with mod_cgi[d] simply by changing the handler from
> fcgid-script to cgi-script.  More people on the users@ mailing list
> are able to help with mod_cgi config issues.
>

i take your advice and now i probe it, thanks :)

i take the dessicion to use mod_fcgid because i use mapserver php
module, and this module does not have a good memory management, and
with mod_fcgid i solve this problems very efficiently.


--
cheers, have a nice day.

Felipe Alcacibar Buccioni.


falcacibar at gmail

Nov 14, 2009, 12:40 PM

Post #5 of 11 (1423 views)
Permalink
Re: mod_rewrite and mod_fcgid pass wrong fcgi request [In reply to]

Thanks Jeff for the response.

>
> I don't know what your rewrite config is, but rewrite isn't required
> to use path info.  Can you post a minimal config that illustrates the
> problem?
>

my current configuration of the mod_rewrite and mod_fcgid
rohan counter # cat /hosting/http/fullplanet.cl/dom/servicio/www/.htaccess
RewriteEngine on

RewriteCond $1 !^($|index\.php|stock|images|subidas|galerias|css|js|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
rohan counter # cat /hosting/http/fullplanet.cl/dom/servicio/www/.htaccess
RewriteEngine on

RewriteCond $1 !^($|index\.php|stock|images|subidas|galerias|css|js|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
--

rohan counter # cat /etc/apache2/modules.d/20_mod_fcgid.conf
<IfDefine FCGID>
LoadModule fcgid_module modules/mod_fcgid.so
FcgidIPCDir /var/run/fcgidsock
FcgidProcessTableFile /var/run/fcgid_shm

FcgidMaxRequestsPerProcess 8
FcgidMaxProcesses 10240
FcgidMaxProcessesPerClass 1024
FcgidMinProcessesPerClass 1
FcgidFixPathinfo 1

AddHandler fcgid-script .php
FcgidWrapper /usr/bin/php-cgi .php

FcgidInitialEnv PHP_FCGI_CHILDREN "8"
FcgidInitialEnv PHP_FCGI_MAX_REQUESTS "1"

<FilesMatch \.php$>
       Options +ExecCGI
</FilesMatch>

DirectoryIndex index.php
</IfDefine>

i using a 307 redirect temporally, but that is the configuration that
give me this problem.

as i told before the file that try to open php-cgi is prefixed with
"redirect:" string.

> Something to consider when debugging mod_fcgid issues is that the same
> config should work with mod_cgi[d] simply by changing the handler from
> fcgid-script to cgi-script.  More people on the users@ mailing list
> are able to help with mod_cgi config issues.
>

i take your advice and now i probe it, thanks :)

i take the dessicion to use mod_fcgid because i use mapserver php
module, and this module does not have a good memory management, and
with mod_fcgid i solve this problems very efficiently.


--
cheers, have a nice day.

Felipe Alcacibar Buccioni.


trawick at gmail

Nov 15, 2009, 8:04 AM

Post #6 of 11 (1420 views)
Permalink
Re: mod_rewrite and mod_fcgid pass wrong fcgi request [In reply to]

On Sat, Nov 14, 2009 at 3:40 PM, Felipe Alcacibar <falcacibar [at] gmail> wrote:
> Thanks Jeff for the response.
>
>>
>> I don't know what your rewrite config is, but rewrite isn't required
>> to use path info.  Can you post a minimal config that illustrates the
>> problem?
>>
>
> my current configuration of the mod_rewrite and mod_fcgid
> rohan counter # cat /hosting/http/fullplanet.cl/dom/servicio/www/.htaccess
> RewriteEngine on
>
> RewriteCond $1 !^($|index\.php|stock|images|subidas|galerias|css|js|robots\.txt)
> RewriteRule ^(.*)$ /index.php/$1 [L]
> rohan counter # cat /hosting/http/fullplanet.cl/dom/servicio/www/.htaccess
> RewriteEngine on
>
> RewriteCond $1 !^($|index\.php|stock|images|subidas|galerias|css|js|robots\.txt)
> RewriteRule ^(.*)$ /index.php/$1 [L]
> --
>
> rohan counter # cat /etc/apache2/modules.d/20_mod_fcgid.conf
> <IfDefine FCGID>
> LoadModule fcgid_module modules/mod_fcgid.so
> FcgidIPCDir /var/run/fcgidsock
> FcgidProcessTableFile /var/run/fcgid_shm
>
> FcgidMaxRequestsPerProcess 8
> FcgidMaxProcesses 10240
> FcgidMaxProcessesPerClass 1024
> FcgidMinProcessesPerClass 1
> FcgidFixPathinfo 1
>
> AddHandler fcgid-script .php
> FcgidWrapper /usr/bin/php-cgi .php
>
> FcgidInitialEnv PHP_FCGI_CHILDREN "8"
> FcgidInitialEnv PHP_FCGI_MAX_REQUESTS "1"
>
> <FilesMatch \.php$>
>        Options +ExecCGI
> </FilesMatch>
>
> DirectoryIndex index.php
> </IfDefine>
>
> i using a 307 redirect temporally, but that is the configuration that
> give me this problem.
>
> as i told before the file that try to open php-cgi is prefixed with
> "redirect:" string.

This is apparently PR 40781:

https://issues.apache.org/bugzilla/show_bug.cgi?id=40781

I see that one or two people have suggested work-arounds in that PR,
but they don't seem to apply directly to your configuration. Perhaps
some mod_rewrite experts on the user list can help solve this, with
some adjustment to your mod_rewrite configuration so that in effect
PATH_TRANSLATED doesn't get left with "redirect:"?

FWIW, changing the FcgidWrapper directive temporarily to point to this
Perl script is helpful for seeing what mod_fcgid is telling PHP:

#!/usr/bin/perl

use strict;
use CGI::Fast;

while (my $q = CGI::Fast->new) {
print "Content-Type: text/plain\r\n\r\n";

foreach my $env (keys %ENV) {
print "env $env = $ENV{$env}\n";
}
}

(though possibly you don't have CGI::Fast or its FCGI dependency installed)

>
>> Something to consider when debugging mod_fcgid issues is that the same
>> config should work with mod_cgi[d] simply by changing the handler from
>> fcgid-script to cgi-script.  More people on the users@ mailing list
>> are able to help with mod_cgi config issues.
>>
>
> i take your advice and now i probe it, thanks :)
>
> i take the dessicion to use mod_fcgid because i use mapserver php
> module, and this module does not have a good memory management, and
> with mod_fcgid i solve this problems very efficiently.

I wasn't very clear with this suggestion ;) My thought was to see
what it takes to get it working with CGI first, as more people could
potentially help with a CGI issue. Once it works with CGI, it should
be straightforward to convert the config to FastCGI. Also, if the
config then doesn't work after converting to FastCGI then it is more
likely a mod_fcgid bug.


falcacibar at gmail

Nov 15, 2009, 2:56 PM

Post #7 of 11 (1436 views)
Permalink
Re: mod_rewrite and mod_fcgid pass wrong fcgi request [In reply to]

...
> This is apparently PR 40781:
>
> https://issues.apache.org/bugzilla/show_bug.cgi?id=40781
>
> I see that one or two people have suggested work-arounds in that PR,
> but they don't seem to apply directly to your configuration.  Perhaps
> some mod_rewrite experts on the user list can help solve this, with
> some adjustment to your mod_rewrite configuration so that in effect
> PATH_TRANSLATED doesn't get left with "redirect:"?

Effectively, that happens to me, but not in cgi mode (cgid) or with
php's libphp5 (apxs module) it happens only with mod_fcgid.

>
> FWIW, changing the FcgidWrapper directive temporarily to point to this
> Perl script is helpful for seeing what mod_fcgid is telling PHP:
>
> #!/usr/bin/perl
>
> use strict;
> use CGI::Fast;
>
> while (my $q = CGI::Fast->new) {
>  print "Content-Type: text/plain\r\n\r\n";
>
>  foreach my $env (keys %ENV) {
>    print "env $env = $ENV{$env}\n";
>  }
> }
>
> (though possibly you don't have CGI::Fast or its FCGI dependency installed)

for no errors i take the straces dumps from php-cgi with mod_cgid and
mod_fcgid, to know better what it's happens here is the vars that
passes to me.

REDIRECT_STATUS: 200
SERVER_NAME: servicio.fullplanet.cl
DOCUMENT_ROOT: /hosting/http/fullplanet.cl/dom/servicio/www
SCRIPT_FILENAME: /hosting/http/fullplanet.cl/dom/servicio/www/index.php
REMOTE_PORT: 1734
REDIRECT_URL: /favicon.ico
GATEWAY_INTERFACE: CGI/1.1
SERVER_PROTOCOL: HTTP/1.1
REQUEST_URI: /favicon.ico
SCRIPT_NAME: /index.php
PATH_INFO: /favicon.ico
PATH_TRANSLATED: redirect:/index.php/favicon.ico

The complete list and the strace dumps have here
http://devel.tryer.cl/fcgid_debug/

...
>
> I wasn't very clear with this suggestion ;)  My thought was to see
> what it takes to get it working with CGI first, as more people could
> potentially help with a CGI issue.  Once it works with CGI, it should
> be straightforward to convert the config to FastCGI.  Also, if the
> config then doesn't work after converting to FastCGI then it is more
> likely a mod_fcgid bug.
>

at least is a bug, that is great to clear me that dude.

but i habe a last dude. The way of the good Open Source Software user
is to report the bug, but where is the bug, in the mod_fcgid or in the
mod_rewrite??

lot of thanks Jeff

--
Felipe Alcacibar Buccioni


trawick at gmail

Nov 15, 2009, 4:04 PM

Post #8 of 11 (1409 views)
Permalink
Re: mod_rewrite and mod_fcgid pass wrong fcgi request [In reply to]

On Sun, Nov 15, 2009 at 5:56 PM, Felipe Alcacibar <falcacibar [at] gmail> wrote:
> ...
>> This is apparently PR 40781:
>>
>> https://issues.apache.org/bugzilla/show_bug.cgi?id=40781
>>
>> I see that one or two people have suggested work-arounds in that PR,
>> but they don't seem to apply directly to your configuration.  Perhaps
>> some mod_rewrite experts on the user list can help solve this, with
>> some adjustment to your mod_rewrite configuration so that in effect
>> PATH_TRANSLATED doesn't get left with "redirect:"?
>
> Effectively, that happens to me, but not in cgi mode (cgid) or with
> php's libphp5 (apxs module) it happens only with mod_fcgid.

When comparing modes of PHP execution:

- CGI and FastCGI are directly comparable because the information that
Apache needs to pass to PHP is the same. (In fact, mod_cgi[d] and
mod_fcgid use the same core Apache code to build almost all of that
information.)

You should be able to take your CGI configuration and change the
handler from cgi-script to fcgid-script and have PHP work as FastCGI.
One nuance is that if you're relying on ScriptAlias you'll need to use
both Alias and Options +ExecCGI in the FastCGI equivalent.

- mod_php and mod_fcgid configurations are not comparable.

>
>>
>> FWIW, changing the FcgidWrapper directive temporarily to point to this
>> Perl script is helpful for seeing what mod_fcgid is telling PHP:
>>
>> #!/usr/bin/perl
>>
>> use strict;
>> use CGI::Fast;
>>
>> while (my $q = CGI::Fast->new) {
>>  print "Content-Type: text/plain\r\n\r\n";
>>
>>  foreach my $env (keys %ENV) {
>>    print "env $env = $ENV{$env}\n";
>>  }
>> }
>>
>> (though possibly you don't have CGI::Fast or its FCGI dependency installed)
>
> for no errors i take the straces dumps from php-cgi with mod_cgid and
> mod_fcgid, to know better what it's happens here is the vars that
> passes to me.
>
> REDIRECT_STATUS: 200
> SERVER_NAME: servicio.fullplanet.cl
> DOCUMENT_ROOT: /hosting/http/fullplanet.cl/dom/servicio/www
> SCRIPT_FILENAME: /hosting/http/fullplanet.cl/dom/servicio/www/index.php
> REMOTE_PORT: 1734
> REDIRECT_URL: /favicon.ico
> GATEWAY_INTERFACE: CGI/1.1
> SERVER_PROTOCOL: HTTP/1.1
> REQUEST_URI: /favicon.ico
> SCRIPT_NAME: /index.php
> PATH_INFO: /favicon.ico
> PATH_TRANSLATED: redirect:/index.php/favicon.ico
>
> The complete list and the strace dumps have here
> http://devel.tryer.cl/fcgid_debug/
>
> ...
>>
>> I wasn't very clear with this suggestion ;)  My thought was to see
>> what it takes to get it working with CGI first, as more people could
>> potentially help with a CGI issue.  Once it works with CGI, it should
>> be straightforward to convert the config to FastCGI.  Also, if the
>> config then doesn't work after converting to FastCGI then it is more
>> likely a mod_fcgid bug.
>>
>
> at least is a bug, that is great to clear me that dude.
>
> but i habe a last dude. The way of the good Open Source Software user
> is to report the bug, but where is the bug, in the mod_fcgid or in the
> mod_rewrite??

I believe that the bug is in mod_rewrite, and is already tracked by

https://issues.apache.org/bugzilla/show_bug.cgi?id=40781


falcacibar at gmail

Nov 15, 2009, 10:04 PM

Post #9 of 11 (1398 views)
Permalink
Re: mod_rewrite and mod_fcgid pass wrong fcgi request [In reply to]

...
> When comparing modes of PHP execution:
>
> - CGI and FastCGI are directly comparable because the information that
> Apache needs to pass to PHP is the same.  (In fact, mod_cgi[d] and
> mod_fcgid use the same core Apache code to build almost all of that
> information.)
>
> You should be able to take your CGI configuration and change the
> handler from cgi-script to fcgid-script and have PHP work as FastCGI.
> One nuance is that if you're relying on ScriptAlias you'll need to use
> both Alias and Options +ExecCGI in the FastCGI equivalent.
>
> - mod_php and mod_fcgid configurations are not comparable.
>

As you sayed it i made a similar environment (the difference is the
FcgidWrapper line) from mod_cgid to mod_fcgid and the result is the
same, in the mod_cgid environment all runs good and in the mod_fcgid
persisst the problem...

rohan counter # cat /etc/apache2/modules.d/70_php5_cgi.conf
<IfDefine PHP5CGI>
ScriptAlias /.httpd/cgi-interpreters /var/cgi-interpreters/
<Directory "/var/cgi-interpreters">
AllowOverride None
Options None
Options +ExecCGI

Order allow,deny
Allow from all
</Directory>

<IfDefine FCGID>
FcgidWrapper "/var/cgi-interpreters/php-cgi" .php
FcgidWrapper "/var/cgi-interpreters/php-cgi" .php2
FcgidWrapper "/var/cgi-interpreters/php-cgi" .php3
FcgidWrapper "/var/cgi-interpreters/php-cgi" .php4
FcgidWrapper "/var/cgi-interpreters/php-cgi" .php5
FcgidWrapper "/var/cgi-interpreters/php-cgi" .phtml

FcgidInitialEnv PHP_FCGI_CHILDREN "12"
FcgidInitialEnv PHP_FCGI_MAX_REQUESTS "1"

AddHandler fcgid-script .php .php3 .php4 .php5 .php6 .phtml
</IfDefine>

<IfDefine !FCGID>
AddHandler php-script .php .php3 .php4 .php5 .php6 .phtml
Action php-script "/.httpd/cgi-interpreters/php-cgi"
</IfDefine>

<FilesMatch \.ph(p[2-6]?|tml)$ >
Options +ExecCGI
</FilesMatch>

DirectoryIndex index.php index.php3 index.php4 index.php5 index.phtml
</IfDefine>


Any suggestion or step to do??...

Thanks Jeff

--
Felipe Alcacibar Buccioni


trawick at gmail

Nov 16, 2009, 4:06 AM

Post #10 of 11 (1383 views)
Permalink
Re: mod_rewrite and mod_fcgid pass wrong fcgi request [In reply to]

On Mon, Nov 16, 2009 at 1:04 AM, Felipe Alcacibar <falcacibar [at] gmail> wrote:
> ...
>> When comparing modes of PHP execution:
>>
>> - CGI and FastCGI are directly comparable because the information that
>> Apache needs to pass to PHP is the same.  (In fact, mod_cgi[d] and
>> mod_fcgid use the same core Apache code to build almost all of that
>> information.)
>>
>> You should be able to take your CGI configuration and change the
>> handler from cgi-script to fcgid-script and have PHP work as FastCGI.
>> One nuance is that if you're relying on ScriptAlias you'll need to use
>> both Alias and Options +ExecCGI in the FastCGI equivalent.
>>
>> - mod_php and mod_fcgid configurations are not comparable.
>>
>
> As you sayed it i made a similar environment (the difference is the
> FcgidWrapper line)

PHP can be configured via Action instead of FcgidWrapper with
mod_fcgid too. That is the most direct comparison.


> from mod_cgid to mod_fcgid and the result is the
> same, in the mod_cgid environment all runs good and in the mod_fcgid
> persisst the problem...
>
> rohan counter # cat /etc/apache2/modules.d/70_php5_cgi.conf
> <IfDefine PHP5CGI>
>        ScriptAlias /.httpd/cgi-interpreters /var/cgi-interpreters/
>        <Directory "/var/cgi-interpreters">
>                AllowOverride None
>                Options None
>                Options +ExecCGI
>
>                Order allow,deny
>                Allow from all
>        </Directory>
>
>        <IfDefine FCGID>
>        FcgidWrapper "/var/cgi-interpreters/php-cgi" .php
>        FcgidWrapper "/var/cgi-interpreters/php-cgi" .php2
>        FcgidWrapper "/var/cgi-interpreters/php-cgi" .php3
>        FcgidWrapper "/var/cgi-interpreters/php-cgi" .php4
>        FcgidWrapper "/var/cgi-interpreters/php-cgi" .php5
>        FcgidWrapper "/var/cgi-interpreters/php-cgi" .phtml
>
>        FcgidInitialEnv PHP_FCGI_CHILDREN "12"
>        FcgidInitialEnv PHP_FCGI_MAX_REQUESTS "1"

BTW, check the mod_fcgid docs for comments on these two PHP
environment variables.

>
>        AddHandler fcgid-script .php .php3 .php4 .php5 .php6 .phtml
>        </IfDefine>
>
>        <IfDefine !FCGID>
>                AddHandler php-script .php .php3 .php4 .php5 .php6 .phtml
>                Action php-script "/.httpd/cgi-interpreters/php-cgi"
>        </IfDefine>
>
>        <FilesMatch \.ph(p[2-6]?|tml)$ >
>                Options +ExecCGI
>        </FilesMatch>
>
>        DirectoryIndex index.php index.php3 index.php4 index.php5 index.phtml
> </IfDefine>
>
>
> Any suggestion or step to do??...

Use Action with mod_fcgid too so that mod_fcgid processing works
through the same mechanisms as with your mod_cgid setup.

I'll try to find some time today to play with that as well.
Eventually I'd like the documentation to show an Action-based example,
with support for easily switching between CGI and FastCGI for
debugging or other purposes.


trawick at gmail

Nov 17, 2009, 7:28 AM

Post #11 of 11 (1322 views)
Permalink
Re: mod_rewrite and mod_fcgid pass wrong fcgi request [In reply to]

On Mon, Nov 16, 2009 at 7:06 AM, Jeff Trawick <trawick [at] gmail> wrote:
> On Mon, Nov 16, 2009 at 1:04 AM, Felipe Alcacibar <falcacibar [at] gmail> wrote:
>> ...
>>> When comparing modes of PHP execution:
>>>
>>> - CGI and FastCGI are directly comparable because the information that
>>> Apache needs to pass to PHP is the same.  (In fact, mod_cgi[d] and
>>> mod_fcgid use the same core Apache code to build almost all of that
>>> information.)
>>>
>>> You should be able to take your CGI configuration and change the
>>> handler from cgi-script to fcgid-script and have PHP work as FastCGI.
>>> One nuance is that if you're relying on ScriptAlias you'll need to use
>>> both Alias and Options +ExecCGI in the FastCGI equivalent.
>>>
>>> - mod_php and mod_fcgid configurations are not comparable.
>>>
>>
>> As you sayed it i made a similar environment (the difference is the
>> FcgidWrapper line)
>
> PHP can be configured via Action instead of FcgidWrapper with
> mod_fcgid too.  That is the most direct comparison.
>
>
>>                          from mod_cgid to mod_fcgid and the result is the
>> same, in the mod_cgid environment all runs good and in the mod_fcgid
>> persisst the problem...
>>
>> rohan counter # cat /etc/apache2/modules.d/70_php5_cgi.conf
>> <IfDefine PHP5CGI>
>>        ScriptAlias /.httpd/cgi-interpreters /var/cgi-interpreters/
>>        <Directory "/var/cgi-interpreters">
>>                AllowOverride None
>>                Options None
>>                Options +ExecCGI
>>
>>                Order allow,deny
>>                Allow from all
>>        </Directory>
>>
>>        <IfDefine FCGID>
>>        FcgidWrapper "/var/cgi-interpreters/php-cgi" .php
>>        FcgidWrapper "/var/cgi-interpreters/php-cgi" .php2
>>        FcgidWrapper "/var/cgi-interpreters/php-cgi" .php3
>>        FcgidWrapper "/var/cgi-interpreters/php-cgi" .php4
>>        FcgidWrapper "/var/cgi-interpreters/php-cgi" .php5
>>        FcgidWrapper "/var/cgi-interpreters/php-cgi" .phtml
>>
>>        FcgidInitialEnv PHP_FCGI_CHILDREN "12"
>>        FcgidInitialEnv PHP_FCGI_MAX_REQUESTS "1"
>
> BTW, check the mod_fcgid docs for comments on these two PHP
> environment variables.
>
>>
>>        AddHandler fcgid-script .php .php3 .php4 .php5 .php6 .phtml
>>        </IfDefine>
>>
>>        <IfDefine !FCGID>
>>                AddHandler php-script .php .php3 .php4 .php5 .php6 .phtml
>>                Action php-script "/.httpd/cgi-interpreters/php-cgi"
>>        </IfDefine>
>>
>>        <FilesMatch \.ph(p[2-6]?|tml)$ >
>>                Options +ExecCGI
>>        </FilesMatch>
>>
>>        DirectoryIndex index.php index.php3 index.php4 index.php5 index.phtml
>> </IfDefine>
>>
>>
>> Any suggestion or step to do??...
>
> Use Action with mod_fcgid too so that mod_fcgid processing works
> through the same mechanisms as with your mod_cgid setup.
>
> I'll try to find some time today to play with that as well.
> Eventually I'd like the documentation to show an Action-based example,
> with support for easily switching between CGI and FastCGI for
> debugging or other purposes.
>

Here is your CGI configuration, munged a bit to work in my setup.
Also, I changed your ScriptAlias to a regular Alias + "SetHandler
cgi-script". That yields a configuration that maps directly to
mod_fcgid.

With this config, I can use either the "SetHandler cgi-script" or the
"SetHandler fcgid-script" to select CGI or FastCGI, and I don't see
the redirect: problem with path info.

Alias /interpreters/ /Users/trawick/inst/5211/bin/

<Directory /Users/trawick/inst/5211/bin/>
# SetHandler cgi-script
SetHandler fcgid-script
AllowOverride None
Options None
Options +ExecCGI
Order allow,deny
Allow from all
</Directory>

AddHandler php-script .php
Action php-script "/interpreters/php-cgi"
<FilesMatch \.php$>
Options +ExecCGI
</FilesMatch>
DirectoryIndex index.php

HTH!

Apache dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.