403 error for CGI

by Reywob(at)aol.com

 Date:  Sat, 22 Jan 2000 11:21:27 EST
 To:  hwg-techniques(at)hwg.org
  todo: View Thread, Original
Hi all,

Just got myself some new webspace, and when I uploaded a simple CGI script 
(no variables, system paths etc...) as index.cgi and set the permissions to 
755, it won't allow me to view it.  The message which appears is:

Forbidden
You don't have permission to access / on this server.


------------------------------------------------------------------------------
--

Apache/1.3.9 Server at www.narrowgauge.f2s.com Port 80


And the script is:

#!/usr/bin/perl 
# 
# Workdir.cgi Version 2.6 
# Last Update: 6/15/98 
# Seaside Enterprises 
# 
#### Usage ######################################## 
# 
# This file is used to test the directory and URL 
# working variables for the mall2000.cgi script. 
# 
################################################### 

$| = 1; 

print "Content-type: text/htmlnn"; 

# Set the setup_ok flag to yes until 
# it finds an error. It will then be set 
# to no and the appropiate error message 
# will be displayed. 

$setup_ok = "yes"; 

# Print the header 

print qq! 






Checking The Script Directory Paths and URL's


------------------------------------------------------------------------------
--
!; 

# Show the version of perl 

print "
Perl Information:

"; 
print "
You are using version $] of Perl.
"; 

# Check for the Current Working Directory library 
# and return the $cwd if OK. 

print "
------------------------------------------------------------------------------
--

Current Working Directory Information:

"; 

$cwd = &get_cwd; 

print "
The current working directory is: $cwd
n"; 

# Get the base URL information 

$baseurl = &base_url; 

print "
------------------------------------------------------------------------------
--

URL Information:



The Base URL is: $baseurl
n"; 

# Get the script URL information 

$scripturl = &script_url; 

print "
The Script URL is: $script_url
n"; 


# Print out the server Environment Variables 
# for reference. May be useful if the cwd errors out. 

print "
------------------------------------------------------------------------------
--

Server Environment Variable Information:

"; 

$get_environment_variables = &environment_variables; 

# and finally, print the footer 

if ($setup_ok eq "yes") { 
print qq~ 

------------------------------------------------------------------------------
--


Congratulations! I looks like your server has passed the test...

The EZ Mall 2000 scripts should run just fine!



Type mall2000.cgi in place of the workdir.cgi in your address line 
above to continue with the test.



 



~; 
} 
else { 
print qq~ 

------------------------------------------------------------------------------
--


WOOPS! It looks like your server HAS NOT passed the test...



Please make the necessary changes as described above before trying 
to run the mall2000.cgi script.

~; 
} 


################################### 
sub base_url 
{ 
local ($ret, $perlwarn); 
$perlwarn = $^W; $^W = 0; 
$ret = 'http://' . $ENV{'SERVER_NAME'}; 
$^W = $perlwarn; 

$base_url = $ret; 

return $base_url; 
} 

################################### 
sub script_url 
{ 
local ($ret, $perlwarn); 
$perlwarn = $^W; $^W = 0; 
$ret = 'http://' . $ENV{'SERVER_NAME'} . $ENV{'SCRIPT_NAME'}; 
$^W = $perlwarn; 

$script_url = $ret; 

return $script_url; 
} 

################################### 
sub environment_variables { 

while (($key, $val) = each %ENV) { 
print "$key = $val
n"; 
} 
} 
################################### 
sub get_cwd 
{ 
# This is for the web server 

$cwd = $ENV{'SCRIPT_FILENAME'}; 

# This next variable is just for people 
# that are using Personal Web Server or 
# NT and perl 32 to test locally. 

if ($ENV{'PERLXS'} eq "PerlIS") 
{ 
$cwd = $0; 
} 

$cwd =~ s/workdir.cgi//g; 
chop $cwd; 

if ($cwd eq "") 
{ 
print qq~ 

I'm sorry, but it appears that the script cannot retreive the Current 
Working Directory from the server.



Don't worry, this is easy to fix.



Just open the mall2000.cgi file in a text only editor and follow the 
instructions to set the cwd manually.


~; 
$setup_ok = "no"; 
$cwd = "Information Unavailable"; 
} 
else 
{ 
$setup_ok = "yes"; 
} 
return $setup_ok, $cwd; 
} 


1; # End workdir 

Any ideas what's wrong?  Is it my account setup?

TIA,
Peter.

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA