Forum Moderators: phranque
#!c:\Dwimperl\perl\site\bin\perl.exe
print "Content-type: text/html; charset=iso-8859-1\n\n";
print "<phtml>";
print "<body>";
print "Test Page";
print "</body>";
print "</html>";
C:\Program Files\Apache Software Foundation\Apache2.2\cgi-bin. If I place it in the htdocs directory then the browser simply displays the content of the file instead of executing it!
#changes I made to my httpd.conf
#these are in top-down order
#defaults
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
#altered defaults for Perl
<Directory "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs">
# add FollowSymLinks +ExecCGI for Perl to execute outside of cgi-bin
Options +Indexes FollowSymLinks +ExecCGI
AllowOverride AuthConfig FileInfo
Order allow,deny
Allow from all
</Directory>
#directive to id cgi-bin
<IfModule alias_module>
ScriptAlias /cgi-bin/ "C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin"
</IfModule>
#permissions for cgi-bin
<Directory "C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
#add handler to execute .cgi .pl outside of cgi-bin
<IfModule mime_module>
TypesConfig conf/mime.types
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
#out of desperation! also altered the
#the Options above to make this work, but it doesn't!
AddHandler cgi-script .cgi .pl
</IfModule>
NameVirtualHost *:80
<Directory "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs">
Options +Indexes FollowSymLinks +ExecCGI
AllowOverride AuthConfig FileInfo
Order allow,deny
Allow from all
</Directory>
<Directory "C:/vHosts/rcs.meinsandkasten.com/web">
Options +Indexes FollowSymLinks +ExecCGI
AllowOverride AuthConfig FileInfo
Order allow,deny
Allow from all
</Directory>
[Thu Apr 05 19:05:07 2012] [error] [client 127.0.0.1] Options ExecCGI is off in this directory: C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/test.pl
#permissions for cgi-bin
<Directory "C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin">
AllowOverride None
#Options None
Options +ExecCGI
Order allow,deny
Allow from all
</Directory>
#!c:/Dwimperl/perl/bin/perl.exe
##
## printenv -- demo CGI program which just prints its environment
##
print "Content-type: text/plain; charset=iso-8859-1\n\n";
foreach $var (sort(keys(%ENV))) {
$val = $ENV{$var};
$val =~ s|\n|\\n|g;
$val =~ s|"|\\"|g;
print "${var}=\"${val}\"\n";
}
ServerRoot "C:/Program Files/Apache Software Foundation/Apache2.2"
Listen *:80
LoadModule actions_module modules/mod_actions.so
LoadModule alias_module modules/mod_alias.so
LoadModule asis_module modules/mod_asis.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authz_default_module modules/mod_authz_default.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule dir_module modules/mod_dir.so
LoadModule env_module modules/mod_env.so
LoadModule include_module modules/mod_include.so
LoadModule isapi_module modules/mod_isapi.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module modules/mod_mime.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule setenvif_module modules/mod_setenvif.so
<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
User daemon
Group daemon
</IfModule>
</IfModule>
ServerAdmin me@myemail.com
DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs"
#default
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
#server root permissions
<Directory "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs">
Options Indexes FollowSymLinks MultiViews +Includes
Order allow,deny
Allow from all
</Directory>
#valid index pages
<IfModule dir_module>
DirectoryIndex index.php index.html index.shtml
</IfModule>
#deny visitor access to .htaccess
#<FilesMatch "^\.ht">
# Order allow,deny
# Deny from all
# Satisfy All
#</FilesMatch>
ErrorLog "logs/error.log"
LogLevel warn
<IfModule log_config_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
<IfModule logio_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>
CustomLog "logs/access.log" common
</IfModule>
#cgi executable dir
<IfModule alias_module>
ScriptAlias /cgi-bin/ "C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin"
</IfModule>
#cgi-bin permissions
<Directory "C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin">
Options +ExecCGI
AllowOverride None
Order deny,allow
Deny from all
</Directory>
DefaultType text/plain
<IfModule mime_module>
TypesConfig conf/mime.types
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddHandler cgi-script .cgi .pl
AddHandler server-parsed .shtml
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
</IfModule>
Include conf/extra/httpd-vhosts.conf
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
#PHP5
LoadModule php5_module "c:/php/php5apache2_2.dll"
AddType application/x-httpd-php .php
PHPIniDir "C:/php"
#!c:/Dwimperl/perl/bin/perl.exe
ScriptAlias /cgi-bin/ "C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin"
<Directory C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin >
SetHandler cgi-script
Options ExecCGI
</Directory>
#cgi executable dir
<IfModule alias_module>
ScriptAlias /cgi-bin/ "C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin/"
</IfModule>
#cgi-bin permissions
<Directory "C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin/">
SetHandler cgi-script
Options ExecCGI
</Directory> [Fri Apr 06 09:24:20 2012] [error] [client 127.0.0.1] client denied by server configuration: C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin/test.pl
#cgi executable dir
<IfModule alias_module>
ScriptAlias /test/ "C:/Program Files/Apache Software Foundation/Apache2.2/test/"
</IfModule>
#cgi-bin permissions
<Directory "C:/Program Files/Apache Software Foundation/Apache2.2/test/">
SetHandler cgi-script
Options ExecCGI
</Directory>
[Fri Apr 06 09:32:05 2012] [error] [client 127.0.0.1] client denied by server configuration: C:/Program Files/Apache Software Foundation/Apache2.2/test/test.pl
C:\Dwimperl\perl\bin
C:\Program Files\Apache Software Foundation\Apache2.2\cgi-bin
http://localhost/cgi-bin/test.pl
#cgi executable dir
<IfModule alias_module>
ScriptAlias /cgi-bin/ "C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin/"
</IfModule>
#cgi-bin permissions
#<Directory "C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin/">
#SetHandler cgi-script
#Options ExecCGI
#</Directory>
[Fri Apr 06 12:02:01 2012] [error] [client 127.0.0.1] client denied by server configuration: C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin/test.pl
[edited by: nyteshade at 4:47 pm (utc) on Apr 6, 2012]
ServerRoot "C:/Program Files/Apache Software Foundation/Apache2.2"
Listen *:80
LoadModule actions_module modules/mod_actions.so
LoadModule alias_module modules/mod_alias.so
LoadModule asis_module modules/mod_asis.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authz_default_module modules/mod_authz_default.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule dir_module modules/mod_dir.so
LoadModule env_module modules/mod_env.so
LoadModule include_module modules/mod_include.so
LoadModule isapi_module modules/mod_isapi.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module modules/mod_mime.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule setenvif_module modules/mod_setenvif.so
<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
User daemon
Group daemon
</IfModule>
</IfModule>
ServerAdmin me@myemail.com
DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs"
#default
#<Directory />
# Options FollowSymLinks
# AllowOverride None
# Order deny,allow
# Deny from all
#</Directory>
#server root permissions
<Directory "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs">
Options Indexes FollowSymLinks MultiViews +Includes
Order allow,deny
Allow from all
</Directory>
#valid index pages
<IfModule dir_module>
DirectoryIndex index.php index.html index.shtml
</IfModule>
#deny visitor access to .htaccess
#<FilesMatch "^\.ht">
# Order allow,deny
# Deny from all
# Satisfy All
#</FilesMatch>
ErrorLog "logs/error.log"
LogLevel warn
<IfModule log_config_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
<IfModule logio_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>
CustomLog "logs/access.log" common
</IfModule>
#cgi executable dir
<IfModule alias_module>
ScriptAlias /cgi-bin/ "C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin/"
</IfModule>
#cgi-bin permissions
#<Directory "C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin/">
#SetHandler cgi-script
#Options ExecCGI
#</Directory>
DefaultType text/plain
<IfModule mime_module>
TypesConfig conf/mime.types
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddHandler cgi-script .cgi .pl
AddHandler server-parsed .shtml
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
</IfModule>
Include conf/extra/httpd-vhosts.conf
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
#PHP5
LoadModule php5_module "c:/php/php5apache2_2.dll"
AddType application/x-httpd-php .php
PHPIniDir "C:/php"