Gossamer Forum
Home : Products : Links 2.0 : Installation -- Unix :

This is very annoying

Quote Reply
This is very annoying
Hi,

I have been messing around with links for a little less than a year. Recently I moved to a whole new server. I used to be on Hypermart.net and then moved to HostRocket.com . Before I had tried to move the database, the script had been working perfectly with a lot of useful mods successfully integrated into it. But, when I transfered over, it is not working at all. I keep on getting a "500 Internal Server Error" and I looked at my logs and it said "Premature end of script headers: /home/httpd/htdocs/wsresource/cgi-bin/links/admin/admin.cgi". I uploaded everything in Ascii and I chmodded everything properly about 10-15 times. I also changed the paths to match to where the server was and everything. I also checked the path to perl which was already the default path. I am assuming that it has to do with the links.cfg file so I posted it below. First, you should know the following:

CGI-Bin Directory
/home/httpd/htdocs/wsresource/cgi-bin/

WWW Directory
/home/httpd/htdocs/wsresource/www

The Public CGI files are in the cgi-bin/links directory and the administration files are in the cgi-bin/links/admin directory. The pages will be built in the www/a directory or just http://wsresource.com/a directory.

Here is my links.cfg file:

# Paths and URL's to Important Stuff
# --------------------------------------------------------
# PATH and URL of Admin CGI directory. No Trailing Slash.
$db_script_path = "/home/httpd/htdocs/wsresource/cgi-bin/links/admin";
$db_dir_url = "http://www.wsresource.com/cgi-bin/links/admin";

# URL of User CGI directory. No Trailing Slash.
$db_cgi_url = "http://www.wsresource.com/cgi-bin/links";

# PATH and URL of Pages to be built. No Trailing Slash.
$build_root_path = "/home/httpd/htdocs/wsresource/www/a";
$build_root_url = "http://www.wsresource.com/a";

# PATH and URL of What's New page. No Trailing slash.
$build_new_path = "$build_root_path/New";
$build_new_url = "$build_root_url/New";

# PATH and URL of What's Cool page. No Trailing slash.
$build_cool_path = "$build_root_path/Cool";
$build_cool_url = "$build_root_url/Cool";

# PATH and URL of What's Rating page. No Trailing slash.
$build_ratings_path = "$build_root_path/Ratings";
$build_ratings_url = "$build_root_url/Ratings";

# Database Options
# --------------------------------------------------------
# You really need to use flock(). However if your system doesn't support it (Win95),
# then turn this off at your own risk!
$db_use_flock = 1;
# Use Pragma: no-cache to stop browsers from caching output? (0 = cache, 1 = nocache)
$db_nocache = 1;
# Use IIS headers? Set this to 1 if your web server needs the full headers (HTTP/1.0 etc.)
$db_iis = 0;
# Field number of category in category.db
$db_main_category = 1;
# Referers -- which hosts are allowed to add to your database.
@db_referers = (www.wsresource.com);

# Email Options
# --------------------------------------------------------
# NOTE: Be sure to edit the text of the message. It can be found
# in the templates directory: email-add.txt, email-del.txt and
# email-mod.txt respectively.

# Set only ONE of either $db_mail_path which should go to a
# mail program like sendmail, or $db_smtp_server which will use
# a SMTP server. Do not set both at once!

# PATH of sendmail. # SMTP Server
$db_mail_path = '/usr/sbin/sendmail';

# Email address of the administrator. BE SURE TO SET!
$db_admin_email = 'webmaster@wsresource.com';

# Notify visitors automatically when their links are validated?
$db_email_add = 1;

# Notify visitors automatically when their links are modified?
$db_email_modify = 0;

# Log all outgoing messages? Put the full path to a logfile and make sure it
# exists and is writeable (chmod 666 -rw-rw-rw-). This logfile can get pretty
# big!
$db_mailer_log = '';

# Build Options
# --------------------------------------------------------
# Setting for popular cutoff, can either be a percent (i.e. top 3%), or
# a fixed value (i.e. top 10). Enter 0.03 or 10 respectively.
$db_popular_cutoff = 20; # Top 20
# Number of days a link is considered New.
$db_new_cutoff = 14; # 14 days old.
# Return search results bolded (1 = yes, 0 = no).
$search_bold = 0;
# The name of an index file.
$build_index = "index.html";
# The extension to use for non index files:
$build_extension = ".html";

# Should your add.cgi automatically select what category the user
# is adding his link into?
$db_single_category = 1;

# Directory Permissions. Do NOT put quotes around it. Set to 0777
# for world writeable. If you put this at 0755, you might need a
# script to remove any directories created as they will be owned
# by the web server or user nobody. Better solution might be to
# run the nph-build routine from the command shell.
$build_dir_per = 0777;

# The script can now break up category pages that have more then x
# number of links in it. It will also create next and previous links
# to help navigate. Set this to 1 if you want to break up pages or 0 if
# you want to have only one page per category.
# Setting this to one, will also break up the What's New pages into
# per day sections (not affected by number of links per page).
$build_span_pages = 1;

# Number of links per page.
$build_links_per_page = 7;

# Detailed View: The script can build a single html page per link. This is
# great if you have a review in your database. To enable, you must set
# the directory where all the pages will be stored, the url to that directory
# and set the enable option.
$build_detailed = 1;
$build_detail_path = "$build_root_path/era";
$build_detail_url = "$build_root_url/era";

$build_detailed2 = 1;
$build_detail_path2 = "$build_root_path/era/thx";
$build_detail_url2 = "$build_root_url/era/thx";

# Use Templates: instead of editing site_html.pl, you can edit regular html pages
# encoded with special <%links_tags%>. It's not as flexible as site_html.pl, but it
# may be easier.
$build_use_templates = 1;

# Site Title, the default title to use. You should really spend some time customizing
# the directory though!
$build_site_title = 'Web Site Resource';

# Date Routines
# --------------------------------------------------------
# Your date format can be whatever you like, as long as the following
# two functions are defined &date_to_unix and &unix_to_date:
# The default is dd-mmm-yyyy.

sub date_to_unix {
# --------------------------------------------------------
# This routine must take your date format and return the time a la UNIX time().
# Some things to be careful about..
# timelocal does not like to be in array context, don't do my($time) = timelocal (..)
# int your values just in case to remove spaces, etc.
# catch the fatal error timelocal will generate if you have a bad date..
# don't forget that the month is indexed from 0!
#
my $date = shift; my $i;
my %months = map { $_ => $i++ } qw!Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec!;
my ($day, $mon, $year) = split(/-/, $date);

exists $months{$mon} or return undef;
$day = int($day); $year = $year - 1900;

require Time::Local;
my $time = 0;
eval {
$time = &Time::Local::timelocal(0,0,0, $day, $months{$mon}, $year);
};
if ($@) { die "invalid date format: $date - parsed as (day: $day, month: $months{$mon}, year: $year). Reason: $@"; }
return $time;
}

sub unix_to_date {
# --------------------------------------------------------
# This routine must take a unix time and return your date format
# A much simpler routine, just make sure your format isn't so complex that
# you can't get it back into unix time.
#
my $time = shift;
my ($sec, $min, $hour, $day, $mon, $year, $dweek, $dyear, $tz) = localtime $time;
my @months = qw!Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec!;
$year = $year + 1900;
return "$day-$months[$mon]-$year";
}

sub long_date {
# --------------------------------------------------------
# This routine is for printing a nicer date format on the what's new page. It should
# take in a date in your current format and return a new one.
my $time = shift;
$time = &date_to_unix ($time);
my ($sec, $min, $hour, $day, $mon, $year, $dweek, $dyear, $tz) = localtime $time;
my @months = qw!January February March April May June July August September October November December!;
my @days = qw!Sunday Monday Tuesday Wednesday Thursday Friday Saturday!;
$year = $year + 1900;
return "$days[$dweek], $months[$mon] $day $year";
}

# -------------------------------------------------------------
# Extra Paths -- unless you feel the need to rename files, you
# can leave this as is.
# -------------------------------------------------------------
$db_script_url = $db_dir_url . "/admin.cgi"; # Admin script.
$db_header_path = $db_script_path . "/header"; # Place to store header and footers.
$db_footer_path = $db_script_path . "/footer";
$build_search_url = $db_cgi_url . "/search.cgi"; # URL of search script.
$build_add_url = $db_cgi_url . "/add.cgi"; # URL of add script.
$build_modify_url = $db_cgi_url . "/modify.cgi"; # URL of modify script.
$build_jump_url = $db_cgi_url . "/jump.cgi"; # URL of jump script.
$build_email_url = $db_cgi_url . "/subscribe.cgi"; # URL of email update script.
$build_rate_url = $db_cgi_url . "/rate.cgi"; # URL of rate script.
$db_mail_url = $db_dir_url . "/nph-email.cgi"; # URL of admin mass mail script.
$build_css_url = $build_root_url . "/links.css"; # URL to your CSS file.

$db_lib_path = $db_script_path; # PATH of library files.
$db_links_name = "$db_script_path/data/links.db"; # PATH to links database.
$db_category_name = "$db_script_path/data/categories.db"; # PATH to category database.
$db_valid_name = "$db_script_path/data/validate.db"; # PATH to validation database.
$db_modified_name = "$db_script_path/data/modified.db"; # PATH to modification database.
$db_url_name = "$db_script_path/data/url.db"; # PATH to URL lookup database.
$db_email_name = "$db_script_path/data/email.db"; # PATH to email database.
$db_links_id_file_name = "$db_script_path/data/linksid.txt"; # PATH to links counter file.
$db_category_id_file_name = "$db_script_path/data/categoryid.txt"; # PATH to category counter file.
$db_hits_path = "$db_script_path/data/hits"; # PATH to hits directory.
$db_template_path = "$db_script_path/templates"; # PATH to templates.
$db_rates_path = "$db_script_path/data/rates"; # PATH to ratings.
1;


I would really appreciate anyones help on this asap because I am leaving tomorrow for about a week.

You should also know that I spent about an hour looking through this site for help in the FAQ's and other other people's posts.

Thanks!

Chris Roane


Quote Reply
Re: This is very annoying In reply to
Make sure that you have the following "require" line in your admin.cgi file:

Code:

require "/home/httpd/htdocs/wsresource/cgi-bin/links/admin/links.cfg";


Regards,

Eliot Lee
Quote Reply
Re: This is very annoying In reply to
I have the same problems, but that didnt help me at all. I cannot figure out why I am getting 500 errors. all my perl paths are right, all permissions are correct. and I am getting really annoyed by this script. what else could be causing this to happen?

Quote Reply
Re: This is very annoying In reply to
If you are using CGIWRAP...search this forum for cgiwrap...Double check your ABSOLUTE paths in the links.cfg for the $db_script_path and $build_root_path variables are correct.

Good luck!

Regards,

Eliot Lee
Quote Reply
Re: This is very annoying In reply to
this still doesnt help me...if you can contact me at chris@syc427.net i have a few questions for you. Thanks
Chris

Quote Reply
Re: This is very annoying In reply to
What are your questions??

Regards,

Eliot Lee
Quote Reply
Re: This is very annoying In reply to
If I was to give you access to my FTP, would you see what is wrong w/ my scripts. I would really be greatful if you could. Thanks for your time..

Chris

Quote Reply
Re: This is very annoying In reply to
Sorry...I really do not have time to do that.

If you could list all the error messages you are receiving, we may be able to help you!

Tongue

Regards,

Eliot Lee
Quote Reply
Re: This is very annoying In reply to
ok, in my error log it says:
Premature end of script headers: /usr/home/v1/a0005038/html/cgi-bin/camaro/admin/admin.cgi

It says Premature end of script headers for all my scripts...what does this mean?


Quote Reply
Re: This is very annoying In reply to
Probably because you have not used the correct ABSOLUTE path to your links.cfg file as I have stated before, which is causing the problems in finding the html_print_headers sub-routine in the db_utils.pl file.

Regards,

Eliot Lee
Quote Reply
Re: This is very annoying In reply to
I have checked all the Absolute Paths and they are all right. Thats what I am stumped on this script...anything else that it could be? Thanks for your time

Chris

Quote Reply
Re: This is very annoying In reply to
Nope...can't think of anything else.

Regards,

Eliot Lee
Quote Reply
Re: This is very annoying In reply to
Check the path to Perl; some installations place Perl in /usr/bin and then set a link to /usr/local/bin/perl. If that link doesn't exist (as was my problem), you'll get the "premature end of headers" message. (You'll probably get a pair of errors in the log, "No such file or directory" followed by "Premature end of script headers" for each failure.) Depending on your privileges in the system, you can either create a link yourself or edit the first line of the links cgi/pl files to point to the proper place.

Maz


Quote Reply
Re: This is very annoying In reply to
I finally got it to work right, for some reason, I had to move my admin folder to something else, I changed it to setup/ and it all works now, I dony know why an admin folder wouldnt work, but that was the problem the whole time. Thanks for everyones help
Chris

Quote Reply
Re: This is very annoying In reply to
Good...glad you figured it out.

Regards,

Eliot Lee