Hi All
I have been on these for 4 days now. No matter what I feed my simple perl script in a simple rewrite_map setup it wont return any feedback when used through apache. When used through comand line it works just fine.
Some background info:
debian:/var/www# apache2 -v
Server version: Apache/2.2.9 (Debian)
Server built: Jun 1 2009 17:44:04
####.htaccess
RewriteEngine on
RewriteCond ${dash2score:yes} yes
RewriteRule ^(.*)$
http://www.howstuffworks.com [P,L]d
or
RewriteEngine on
RewriteRule ^(.*)$
http://www.google.com/?index=${dash2score:yes} [P,L]
#####Apache2.conf
RewriteLog "/var/log/apache2/rewrite.log"
RewriteLogLevel 9
RewriteMap dash2score prg:/var/www/getIpStat.pl
##### getIpStat.pl
#!/usr/bin/perl
$| = 1;
while (<STDIN>) {
print($_."\n");
}
or
#!/usr/bin/perl
$| = 1;
while (<STDIN>) {
print($_."\n");
}
Well, the perl script simply returns whatever it is fed, so If I feed it yes it returns yes, this would not work when I used the rewritemap with rewritecond I would alwasy get no output. Since rewritecond would return input='' as if rewritecond is not returning any input. The log showed:
192.168.0.189 - - [30/Jun/2009:18:00:08 +0300] [
192.168.0.1/sid#9500ba8][rid#b5f40078/subreq] (5) map lookup FAILED: map=dash2score key=yes
192.168.0.189 - - [30/Jun/2009:18:00:08 +0300] [
192.168.0.1/sid#9500ba8][rid#b5f40078/subreq] (4) [perdir /var/www/] RewriteCond: input='' pattern='yes' => not-matched
192.168.0.189 - - [30/Jun/2009:18:00:08 +0300] [
192.168.0.1/sid#9500ba8][rid#b5f40078/subreq] (1) [perdir /var/www/] pass through /var/www/index.pl
Note the input='' above I.e. rewritecond did not show get any input from the rewrite map
When I did try to use the rewritemap in the rewriterule as in the second example it did not display anything as well in the result URL. The log showed:
192.168.0.189 - - [30/Jun/2009:17:58:17 +0300] [
192.168.0.1/sid#9500ba8][rid#b61c4610/initial] (5) map lookup FAILED: map=dash2score key=yes
192.168.0.189 - - [30/Jun/2009:17:58:17 +0300] [
192.168.0.1/sid#9500ba8][rid#b61c4610/initial] (2) [perdir /var/www/] rewrite '' -> '
http://www.google.com/?index='
Note the index=' above
If I run the script from command line the following is shown:
debian:/var/www# ./getIpStat.pl
input1
input1
I enter input1 and it echoes input1
These are the permissions of the script:
-rwxr-xr-x 1 www-data root 352 2009-06-30 16:40 getIpStat.pl
and I did su to www-data and I was able to execute it successfully.
I really have no clue why the script is not returning any output when invoked through apache.
Any clues ?
Thanks