Web Hosting Talk







View Full Version : Setting up SendForm.cgi


Olternit
09-16-2003, 04:38 PM
I have a few problems with setting up sendform.cgi (http://www.scn.org/~bb615/scripts/sendform.html) and I'd appreciate some help. Here's my setup:

#===============================================================
# configuration
#================================================================

# You'll need to set the following variables.

#-----
# Uncomment one of these two @GoodReferrers lines.
# (omit "www" prefix if people can use your URLs without it)
# NOTE: Enter these domain names in lowercase. However, the script
# allows incoming domain names to be in uppercase or mixed case.

# For using forms on one server:
@GoodReferrers = ('olternit.com');

# For using forms on any of several servers:
# @GoodReferrers = ('yetanother.org', 'andyetanother.org');

#-----
# Where mail from the form is sent, if not otherwise specified.
# Applies only if you don't use "to" or "MailtoAddress" on the form.
# It's also the default for the mailto link on the generic thanks page.
# NOTE: There's no need to escape the @ in the address here by using \@

$DefaultMailtoPrompt = "Questions:";
$DefaultTo = 'webmaster@olternit.com';
$DefaultToName = 'Webmaster';

#-----
# Automatically send a copy of the form data to the user?
# (can override this default on the form)

$DefaultSendCopyToUser = 1;

#-----
# Subject line to use if none is specified on the form:

$DefaultSubject = "Web Form Data";

#-----
# When one of these words is used alone as the subject, the
# subject line of the mail sent to the recipient will be blank.
# Examples:
# <input type=hidden name=subject value="none">
# or <input type=hidden name=subject value="blank">

$BlankSubjectWords = "none|blank";

#-----
# Path to mail program:
# To find this out, type "which sendmail" at the Unix prompt.
# (If you see a "Form Error" message during installation, a bad path to
# sendmail is the most likely cause.)
# -oi avoids ending input at a . on a line by itself
# -oeq avoids some difficulties if address is invalid
#
# You can use another mail program, if you set it to the equivalent
# of sendmail's -t parameter.

$MailProgram = '/usr/sbin/sendmail -t -oi -oeq';

#-----
# Default return prompt to display on the default echo page:
# (Applies only if you don't specify your own echo page, don't use
# redirection, and don't specify a return link on the form with a
# hidden ReturnLinkURL, and HTTP_REFERER is not present.)

$DefaultReturnLinkURL = "http://www.olternit.com/";
$DefaultReturnLinkTitle = "Olternit";

#-----
# Default background color and image for the generic thanks page
# and other generated pages (error page, required fields page, etc.)
# You can override these with "Bgcolor" and "Background" form variables.

# CAUTION: Leaving $DefaultBgcolor blank ("") produces black.
$DefaultBgcolor = "#FFFFFF";

# If you don't have a background image, set this to "" because using a
# nonexistent filename may cause the dreaded "Internal Server Error".
# (something to fix next time)
#
# $DefaultBackground = "/ivory.gif";
$DefaultBackground = "";

$DefaultThanksMessage = "This is what you entered on the form.\n";

#-----
# File extensions that can be used for echo pages:
# This prevents reading other than HTML files.
# Add other plain HTML file extensions that your server may use.
# Echoing will not work on pages that use server-side includes.
$EchoFileExts = "\.html|\.htm";

#-----
# Can forms send files to the user, as part of any e-mail sent when the
# user submits the form?
$EnableBlurbFiles = 1;

# These string(s) or regexp(s) define the roots of any allowed Web paths
# under which directories may contain blurb files to be sent in e-mail:
@WebDocumentPaths = ('/web/', '/usr/public/www/');

# These string(s) or regexp(s) define the roots of any allowed non-Web
# paths under which directories may contain blurb files:
@NonWebDocumentPaths = ('/nonweb/', '/usr/somewhere/else/');

# E-mailed blurb files must end in one of these file extensions:
$BlurbFileExts = "\.txt|\.html|\.htm";


#-----
# Note included in mail confirmation to user:
$DefaultUserMailNote = "For your records, this is what you entered on the form.";


Below that I left everything as it was. I then uploaded sendform.cgi into my /cgi-bin/, but it's not working. It's giving me an "Internal Server Error". Please, contact me on AIM (Olternit) or just reply to this post if you can help.

bear
09-16-2003, 05:49 PM
2 easy things to try.
Did you upload in ASCII mode? If not, do so.
Did you set permissions on the script to 755?

Another possibility is that you used a non-plain text editor to make the changes. This can introduce formatting that can break scripts.
Okay, so this is #4.
Did you set the path to PERL correctly on the one you uploaded?

Olternit
09-16-2003, 05:59 PM
Ok, I've switched the permissions to 755.

Originally posted by bear
Did you set the path to PERL correctly on the one you uploaded?
Where do I set the path to perl? I see this:

#!/usr/local/bin/perl
But, it's commented out. Should I remove the comment and put !/usr/bin/perl which is the cPanel perl path?

bear
09-16-2003, 06:08 PM
Originally posted by Olternit
Ok, I've switched the permissions to 755.


Where do I set the path to perl? I see this:

#!/usr/local/bin/perl
But, it's commented out. Should I remove the comment and put !/usr/bin/perl which is the cPanel perl path? That is the path to PERL. On many Cpanel servers it's #!/usr/bin/perl but it depends on the install. Leave the #! in front, as it's the "shebang". It has special meaning to PERL.

Olternit
09-16-2003, 06:12 PM
cPanel gives me:

PERL version 5.008
Path to PERL /usr/bin/perl

I've tried:

#!/usr/bin/perlBut, no luck either.

The form in question is:

http://www.olternit.com/form3.html

Olternit
09-16-2003, 11:09 PM
bear fixed my problem. Praises to him!

OverlordQ
09-17-2003, 11:31 AM
Originally posted by bear
That is the path to PERL. On many Cpanel servers it's #!/usr/bin/perl but it depends on the install. Leave the #! in front, as it's the "shebang". It has special meaning to PERL.

IIRC, it has special meaning to the system not perl, it tells what interpreter to use.

bear
09-17-2003, 12:08 PM
Right you are. I was referring to the fact that PERL would not interpret the # as a comment, and misspoke. The #! could just as easily call any interpreter...