I've been lurking here for the past few days, and I have seen a lot of messages regarding both 500 (Internal Error) and 403 (Forbidden) errors when accessing db.cgi. I have solved my problem (with the wonderful help of this forum and JPDeni's Tutorial), and you can too!!!
For the 500 error, you probably well know that the script MUST be in ASCII, not Binary, format. Poor JPDeni can't say it enough!!! :) My site resides on a free browser-based Linux desktop, and in order to upload files, you have to use their web-based file upload utility, which means there's no control over Binary/ASCII. I found this script that strips CR/LF characters from text files you specify. It helped me tremendously. I ended up actually printing it out from my Win98 machine and re-typing it in Linux to make sure it would be in ASCII. If you are having problems with a 500 error, thank some guy named Tomas for this script:
#!/usr/bin/perl
# this script strips the \r in file passed on the cmd line
# for usage run rmcrlf without any arguments
use Cwd;
sub strip {
$fname = $_[0];
while(<${fname}>)
{
print " looking for $_:";
unless (open(IFILE,"<$_")){
print " does not exist (skipping)\n";
next;
}
unless (open(OFILE,">$_.n")) {
print " unable to create temp file $_.n !\n";
next;
}
print " processing: ";
while (defined($line = <IFILE>)) {
$line =~ s/\r\n/\n/;
print OFILE $line;
} #while
close OFILE;
close IFILE;
rename "$_.n", $_;
print "done\n";
} #while
}
#######################################
# strip the default files
sub stripd {
print "stripping DBMan Files\n";
strip("*.db");
strip("*.cfg");
strip("*.pl");
strip("*.pass");
strip("*.count");
strip("*.log");
}
##########################################################
# strip the default files recursively
# in the current directory and all
# subdirectories below it
sub stripr {
my $cdir = cwd();
print "\nentering directory: $cdir\n";
stripd;
opendir CDIR, $cdir;
my @alldirs = grep !/^\.\.?$/ && -d "$cdir/$_", readdir CDIR;
closedir CDIR;
foreach $alldirs (@alldirs) {
chdir "$cdir/$alldirs";
stripr();
}
}
sub help {
print "\n*----------------------------------------*\n";
print "WARNING!!! YOU SHOULD MAKE BACKUPS OF THE\n";
print "FILES YOU WISH TO PROCESS BEFORE USING THIS\n";
print "PROGRAM. SHOULD SOMETHING GO WRONG YOU COULD\n";
print "PERMANENTLY LOOSE THESE FILES SINCE THE\n";
print "ORGINALS ARE DELETED !!!\n\n";
print "rmcrlf - carriage return stripper\n";
print "usage: rmcrlf filename\n";
print " rmcrlf option\n";
print "\nwhere\n";
print " filename - any valid filename; if using\n";
print " wildcards, enclose in double\n";
print " quotes, e.g.\n";
print " rmcrlf \"*.mak\"\n\n";
print " option - -d DBMan files in current\n";
print " directory (you can change\n";
print " the defaults by modifying\n";
print " sub stripd)\n";
print " -r default files recursively in\n";
print " current directory and its\n";
print " subdirectories\n";
print " -h display this message\n";
print "*----------------------------------------*\n\n";
}
##########################################################
# here we go, the program itself
if($ARGV[0]){
if($ARGV[0] eq "-d")
{
stripd();
}
elsif($ARGV[0] eq "-r")
{
stripr();
}
elsif($ARGV[0] eq "-h")
{
help;
}
else
{
strip($ARGV[0]);
}
}
else{
help;
}
#end rmcrlf
Now, for the 403 error: from my (little) experience, I have found that everyone's servers are set up differently. Some allow you to have a subdirectory in cgi-bin (i.e. /cgi-bin/dbman), and some don't, regardless of the permissions set for the directory (somebody with more experience could probably tell you why, if you're curious). If you are getting a 403 error even after you have checked and re-checked your permissions, just move them to cgi-bin. Make sure you change $db_dir_url in default.cfg.
Hope this helped someone!!! Knowing this 72 hours ago would have saved me lots of time... :)
redshift777
For the 500 error, you probably well know that the script MUST be in ASCII, not Binary, format. Poor JPDeni can't say it enough!!! :) My site resides on a free browser-based Linux desktop, and in order to upload files, you have to use their web-based file upload utility, which means there's no control over Binary/ASCII. I found this script that strips CR/LF characters from text files you specify. It helped me tremendously. I ended up actually printing it out from my Win98 machine and re-typing it in Linux to make sure it would be in ASCII. If you are having problems with a 500 error, thank some guy named Tomas for this script:
#!/usr/bin/perl
# this script strips the \r in file passed on the cmd line
# for usage run rmcrlf without any arguments
use Cwd;
sub strip {
$fname = $_[0];
while(<${fname}>)
{
print " looking for $_:";
unless (open(IFILE,"<$_")){
print " does not exist (skipping)\n";
next;
}
unless (open(OFILE,">$_.n")) {
print " unable to create temp file $_.n !\n";
next;
}
print " processing: ";
while (defined($line = <IFILE>)) {
$line =~ s/\r\n/\n/;
print OFILE $line;
} #while
close OFILE;
close IFILE;
rename "$_.n", $_;
print "done\n";
} #while
}
#######################################
# strip the default files
sub stripd {
print "stripping DBMan Files\n";
strip("*.db");
strip("*.cfg");
strip("*.pl");
strip("*.pass");
strip("*.count");
strip("*.log");
}
##########################################################
# strip the default files recursively
# in the current directory and all
# subdirectories below it
sub stripr {
my $cdir = cwd();
print "\nentering directory: $cdir\n";
stripd;
opendir CDIR, $cdir;
my @alldirs = grep !/^\.\.?$/ && -d "$cdir/$_", readdir CDIR;
closedir CDIR;
foreach $alldirs (@alldirs) {
chdir "$cdir/$alldirs";
stripr();
}
}
sub help {
print "\n*----------------------------------------*\n";
print "WARNING!!! YOU SHOULD MAKE BACKUPS OF THE\n";
print "FILES YOU WISH TO PROCESS BEFORE USING THIS\n";
print "PROGRAM. SHOULD SOMETHING GO WRONG YOU COULD\n";
print "PERMANENTLY LOOSE THESE FILES SINCE THE\n";
print "ORGINALS ARE DELETED !!!\n\n";
print "rmcrlf - carriage return stripper\n";
print "usage: rmcrlf filename\n";
print " rmcrlf option\n";
print "\nwhere\n";
print " filename - any valid filename; if using\n";
print " wildcards, enclose in double\n";
print " quotes, e.g.\n";
print " rmcrlf \"*.mak\"\n\n";
print " option - -d DBMan files in current\n";
print " directory (you can change\n";
print " the defaults by modifying\n";
print " sub stripd)\n";
print " -r default files recursively in\n";
print " current directory and its\n";
print " subdirectories\n";
print " -h display this message\n";
print "*----------------------------------------*\n\n";
}
##########################################################
# here we go, the program itself
if($ARGV[0]){
if($ARGV[0] eq "-d")
{
stripd();
}
elsif($ARGV[0] eq "-r")
{
stripr();
}
elsif($ARGV[0] eq "-h")
{
help;
}
else
{
strip($ARGV[0]);
}
}
else{
help;
}
#end rmcrlf
Now, for the 403 error: from my (little) experience, I have found that everyone's servers are set up differently. Some allow you to have a subdirectory in cgi-bin (i.e. /cgi-bin/dbman), and some don't, regardless of the permissions set for the directory (somebody with more experience could probably tell you why, if you're curious). If you are getting a 403 error even after you have checked and re-checked your permissions, just move them to cgi-bin. Make sure you change $db_dir_url in default.cfg.
Hope this helped someone!!! Knowing this 72 hours ago would have saved me lots of time... :)
redshift777