View Full Version : Need help!! with cgi bin
cddcman
03-23-2003, 08:21 AM
I am out of options, I have tried a number of cgi scripts in my cgi-bin that my service provider supplied and the mod seems to change fine, 775. I have been mostly using FormMail.pl and I always get the error internal server error, and in the log it says "Premature end of script headers" is there a script I can use to test my cgi bin? does it sound like my provider needs to turn some access on, I really have no clue any help would be great.
thanks
cddcman
03-23-2003, 08:52 AM
this is one of the scripts I was trying..
#!/usr/bin/perl
##############################################################################
# FormMail Version 1.92 #
# Copyright 1995-2002 Matt Wright mattw@scriptarchive.com #
# Created 06/09/95 Last Modified 04/21/02 #
# Matt's Script Archive, Inc.: http://www.scriptarchive.com/ #
##############################################################################
# COPYRIGHT NOTICE #
# Copyright 1995-2002 Matthew M. Wright All Rights Reserved. #
# #
# FormMail may be used and modified free of charge by anyone so long as this #
# copyright notice and the comments above remain intact. By using this #
# code you agree to indemnify Matthew M. Wright from any liability that #
# might arise from its use. #
# #
# Selling the code for this program without prior written consent is #
# expressly forbidden. In other words, please ask first before you try and #
# make money off of my program. #
# #
# Obtain permission before redistributing this software over the Internet or #
# in any other medium. In all cases copyright and header must remain intact. #
##############################################################################
# ACCESS CONTROL FIX: Peter D. Thompson Yezek #
# http://www.securityfocus.com/archive/1/62033 #
##############################################################################
# Define Variables #
# Detailed Information Found In README File. #
# $mailprog defines the location of your sendmail program on your unix #
# system. The flags -i and -t should be passed to sendmail in order to #
# have it ignore single dots on a line and to read message for recipients #
$mailprog = '/usr/sbin/sendmail -i -t';
# @referers allows forms to be located only on servers which are defined #
# in this field. This security fix from the last version which allowed #
# anyone on any server to use your FormMail script on their web site. #
@referers = ('silverfoxbuildinggroup.com','www.silverfoxbuildinggroup.com','209.5.206.21');
# @recipients defines the e-mail addresses or domain names that e-mail can #
# be sent to. This must be filled in correctly to prevent SPAM and allow #
# valid addresses to receive e-mail. Read the documentation to find out how #
# this variable works!!! It is EXTREMELY IMPORTANT. #
@recipients = ('^heman69\@mail.com');
# ACCESS CONTROL FIX: Peter D. Thompson Yezek #
# @valid_ENV allows the sysadmin to define what environment variables can #
# be reported via the env_report directive. This was implemented to fix #
# the problem reported at http://www.securityfocus.com/bid/1187 #
@valid_ENV = ('REMOTE_HOST','REMOTE_ADDR','REMOTE_USER','HTTP_USER_AGENT');
# Done #
##############################################################################
# Check Referring URL
&check_url;
# Retrieve Date
e"t_date;
# Parse Form Contents
&parse_form;
.....................................................
the rest is the standard stuff
Thanks in advance
MotherNatrsSon
04-01-2003, 07:53 AM
I am going to go out on a limb here and suggest that you be sure you are uploading the script in ASCII mode and not binary in your FTP program. If it is uploaded in binary instead of ASCII you will get that error because the line breals are not correct.....Make any sense?
I'll join you on another limb :) Is it possible that the CHMOD should be 755? Might this make the difference?
$mailprog = '/usr/sbin/sendmail -i -t';
Are you sure that's right? I think it would be /usr/bin/sendmail though I could be wrong.
MotherNatrsSon
04-08-2003, 05:02 PM
Matt's Scripts have been noted as having errors in them.
Your fist line should get changed to:
#!/usr/bin/perl -w
This will give you a detailed line by line error if your server has a cgi error log. It will tell you exactly which line of the script is wrong.
The new version has very few errors, and the formmail is the most widely used in the web.
But also, to check for script syntax errors add -c to the end. Maybe yours is a corrupted script.
YUPAPA
04-09-2003, 10:39 PM
Upgrade it... my eyes were blind when I looked at the 2000 lines of source code... :p
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.