Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: execute script when GET request come on Apache |
|
Author |
|
rupesh chandurkar
Joined: 30 Aug 2013 Posts: 2 Location: India , Mumbai
|
Posted: Fri 30 Aug '13 15:09 Post subject: execute script when GET request come on Apache |
|
|
Hi All,
if any GET request are coming on Apache I want execute my "try.pl". I used "Script" directive for execute script "Script GET /cgi-bin/try.pl".
I access this web sites but my perl script is not execute.
My configuration file is
<VirtualHost *:80>
ServerAdmin server-alerts@qlc.in
DocumentRoot /web/domainname/htdocs
ServerName domainname
ServerAlias www.domainname domainname
LogFormat "%h|%l|%u|%t|\"%r\"|%s|%b|\"%{Referer}i\"|\"%{User-Agent}i\"|%v"
DirectoryIndex index.htm index.html index.phtml index.phtm index.php3 index.php
AddType application/x-httpd-php .php
AddType application/x-httpd-php .php3
AddType application/x-httpd-php .phtml
AddType application/x-httpd-php .html
AddType application/x-httpd-php .htm
AddType application/x-httpd-php .inc
AddType application/x-httpd-php .htx
AddHandler cgi-script .cgi .pl
ErrorLog /var/log/httpd/qerror_log
TransferLog /var/log/httpd/access_log
ScriptLog /var/log/httpd/cgi_errors_logs
ForensicLog /var/log/httpd/ForensicLog_logs
<Directory "/web/domainname/htdocs">
AllowOverride None
Options +ExecCGI
Order allow,deny
Allow from all
</Directory>
Script GET /cgi-bin/try.pl
ScriptAlias /cgi-bin /web/domainname/htdocs/cgi-bin/
</VirtualHost>
my perl script "try.pl"
=================================================
#!/bin/perl
use warnings;
use strict;
use Apache2::Const -compile => qw(M_GET);
use Output::Cmd;
my $logfile = "/tmp/try.log";
my $u = Output::Cmd->new('verbose' => 1, 'log' => $logfile);
my $r = shift;
$u->print("request: $r");
1;
====================================================
Why my script is not execute using "Script" directive. how i can debug
http://httpd.apache.org/docs/2.0/mod/mod_actions.html#script
Thanks in advance ..... |
|
Back to top |
|
glsmith Moderator
Joined: 16 Oct 2007 Posts: 2268 Location: Sun Diego, USA
|
Posted: Fri 30 Aug '13 19:59 Post subject: |
|
|
Per docs;
Also note that Script with a method of GET will only be called if there are query arguments present (e.g., foo.html?hi). Otherwise, the request will proceed normally.
So most GET requests will not have any action taken since they do not contain any query arguments. |
|
Back to top |
|
rupesh chandurkar
Joined: 30 Aug 2013 Posts: 2 Location: India , Mumbai
|
Posted: Mon 02 Sep '13 6:44 Post subject: |
|
|
Thanks for rely glsmith,
Can you please give me one example of "query arguments"
for my understanding.
eg. Test page with code for GET request |
|
Back to top |
|
|
|
|
|
|