PDA

Visualizza la versione completa : cgi perl apache2.2 windows xp


polenta70
28-09-2009, 13:06
ho problemi a richiamare da html



un semplice contatore

#!C:\Perl\bin\perl
$your_ip = "127.0.0.1";
$directory = "c:/Programmi/Apache Software Foundation/Apache2.2/cgi-bin/log/";
$print = '1';
$count = "counter.dat";
$log = "log.dat";
##############
#Script Begins
$shortdate = localtime ;
if ($ENV{'REMOTE_ADDR'} ne $your_ip)
{
open (COUNT, "$directory$count");
$counter = <COUNT>;
close (COUNT);
open (COUNT, "> $directory$count");
$counter += 1;
print COUNT "$counter";
close (COUNT);
open (LOG, ">>$log");
print "Content-type: text/plain\n\n ";
print LOG "Time: $shortdate\n";
print LOG "Host: $ENV{'REMOTE_HOST'}\n";
print LOG "With: $ENV{'HTTP_USER_AGENT'}\n";
print LOG "From: $ENV{'HTTP_REFERER'}\n";
print LOG "HTTP_HOST: $ENV{'HTTP_HOST'}\n";
print LOG "HTTP_UA_CPU: $ENV{'HTTP_UA_CPU'}\n";
print LOG "REMOTE_ADDR: $ENV{'REMOTE_ADDR'}\n";
print LOG "REMOTE_PORT: $ENV{'REMOTE_PORT'}\n";
print LOG "REQUEST_URI: $ENV{'REQUEST_URI'}\n\n";
close (LOG);
if ($print eq '1')
{
print "$counter";
}
}
else
{
print "Content-type: text/plain\n\n";
print "$your_ip";
}

di seguito alcuni stalci di httpd
<Directory />
Options FollowSymLinks +Includes
AllowOverride None
Order deny,allow
Deny from all
AddHandler server-parsed html
</Directory>
<Directory "C:/Programmi/Apache Software Foundation/Apache2.2/htdocs">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<IfModule alias_module>
ScriptAlias /cgi-bin/ "C:/Programmi/Apache Software Foundation/Apache2.2/cgi-bin/"
</IfModule>
<Directory "C:/Programmi/Apache Software Foundation/Apache2.2/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>


se chiamo direttamente il contatore da firefox viene eseguito correttamente da ie chiede aprire o scaricare e con aprire lo esegue.
dove sbaglio?

polenta70
28-09-2009, 21:22
un problema di configurazione. con seguente ok:
<Directory />
Options FollowSymLinks +Includes
AllowOverride None
Order deny,allow
Deny from all
</Directory>
<Directory "C:/Programmi/Apache Software Foundation/Apache2.2/htdocs">
Options Indexes FollowSymLinks +Includes
AllowOverride None
Order allow,deny
Allow from all
AddHandler server-parsed html
</Directory>
<Directory "C:/Programmi/Apache Software Foundation/Apache2.2/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>

Loading