Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

After submit button is clicked cgi page does not open- internal error

Status
Not open for further replies.

chuckID

Technical User
Oct 1, 2002
8
US
Hi,

I was able to get one of my .cgi scripts to work located at But when the submit button is clicked, I receive the error:
"Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request." This page is supposed to load:
I am supposed to just edit two setup pages (admin.setup and sample.setup) to make this rather involved email management system work. Why wouldn't this submit_data.cgi page load? Are my paths incorrect in the .setup files? The submit_data.cgi is definately upload to my cgi-bin. Can the scripts find my submit_data.cgi script using the below paths? Below are the variables that are supposed to be changed in the admin.setup and sample.setup files:
# Variables

# 1. Mail agent options. By default, @Manager uses the smtp server on
# your server, but can be reset to use sendmail. Sendmail only applies to
# Unix-type servers, while smtp should work on both Unix and Windows servers.
# Sendmail may bog down when sending email to large lists.
#$use_smtp = "on";
#$smtp = "mail.pointxpress.com";

$bcc_packet = 200; # batch size for Bcc mail

$use_sendmail = "on";
$SENDMAIL = "/usr/sbin/sendmail -t";

# 2. The e-mail address of the site owner
$MERCHANT = 'myemail.com';

# 3. The password to login to the merchant admin
$password = "password";

# 4. List of domains and IPs which have permission to make requests from the script.
# List all IP and domains in quotes and separated by commas.
@referers = ('mydomain.com', ' '##.###.###.###'); # required

# file and path references
# all paths should be relative to the CGI directory that the admin.cgi is in.

# 5. Path to database data (.db) file
# For data security this directory should not be accessible by a browser
$db_directory = "../data_4523657/"; # trailing slash required

# 6. Path to standard HTML documents directory
$html_path = "../atm_help/"; # trailing slash required

# 7. Path and file name for @-Manager admin interface script (from domain i.e. $script_url = "../cgi-bin/admin.cgi";

# 8. Path and file name for form response file.
$splashpage = "../splash.html";

# 9. Directories to search for e-mail template files when using bulk mail.
# Can enter multiple directories, put path in quotes and separated by commas.
@template_directories = ("../emails");

# 10. Path to help files
$help_path = "../atm_help/";

# 11. Name of online help frameset.
$helpfile = "atm_help.html";
$aboutfile = "atm_about.html";

#################### and sample.setup ################

# 1. - The name of the table this setup file is to work with
$db = "sample";

###################################################
# Variables

# 2. Mail agent options. By default, @Manager uses the smtp server on
# your server, but can be reset to use sendmail. Sendmail only applies to
# Unix-type servers, while smtp should work on both Unix and Windows servers.

$use_smtp = "on";
$smtp = "mail.pointxpress.com";

#$use_sendmail = "on";
#$SENDMAIL = "/usr/sbin/sendmail -t";

# 3. The e-mail address of the site owner
$MERCHANT = 'myemail.com';

# 4. List of domains and IPs which have permission to make request from the script.
# List all IP and domains in quotes and separated by commas.
@referers = ('mydomainname.com', ' '##.###.###.###'); # required

###################################################
# file and path references
# all paths should be relative to the CGI directory in which are located
# the files create_form.cgi and submit_data.cgi

# 5. Path to database data (.db) file
# For data security this directory should not be accessible by a browser
$db_directory = "../data/"; # trailing slash required

# 6. Path to standard HTML documents directory
$html_path = "../"; # trailing slash required

# 7. The HTML template for auto-generated forms
$ret_file = "./default_form.html";

# 8. The HTML template that is returned when a form is submitted with a missing
# required field
$error_file = "./required_field_error.html";

# 9. The HTML template that is returned after a successful form submission
$splashpage = "./splash.html";

# 10. The domain that the @-Manager resides on
$url = "
# 11. Set to 1 to allow empty fields on form submission. Required fields are
# still verified.
$allow_empty_fields_on_insert = 1;

# 12. number of fields to display on auto-generated forms.
# Note use the total required fields - 1.
$form_fields = 14;

###################################################
# Form submission actions. When a form is submitted data can be saved to a
# table, an email can be sent to the merchant, and email can be sent to the
# customer (person submitting)

# 13. If set to "0", emails are sent, but no DB is written to (formmail mode)
$write_to_db = 1;

# 14. Uncomment the option you want to use. Only uncomment 1.
#$cust_email_only = "on";
#$merc_email_only = "on";
$email_both = "on";

# 15. If you turned on merc_email_only or email_both specify where the
# template can be found to e-mail to the merchant (merc_email_template)
# likewise for the cust_email template if cust email is turned on
$merc_email_template = "../emails/merc_email.tpl";
$cust_email_template = "../emails/cust_email.tpl";

# 16. Provide a subject for the merchant and customer e-mail messages
# if the respective sumbission e-mails are turned on.
$merc_subject = "Whatever";
$cust_subject = "Whatever";
 
Check your servers error logs! There's always a better way...
 
Also, it helps if you put this at the top:
Code:
use CGI::Carp qw/fatalsToBrowser/;
This is a very convenient method for making wonderful error messages show up in your browser instead of the same 'ol "Internal Server Error".

Hope this helps.

--jim
 
Ok much better,

Thanks for making the error more explicit. Here it is:
Can't locate Sendmail.pm in @INC (@INC contains: /usr/lib/perl5/5.6.1/i686-linux /usr/lib/perl5/5.6.1 /usr/lib/perl5/site_perl/5.6.1/i686-linux /usr/lib/perl5/site_perl/5.6.1 /usr/lib/perl5/site_perl .) at submit_data.cgi line 10.
BEGIN failed--compilation aborted at submit_data.cgi line 10.

Line 10 is:
use Sendmail;

What is @INC (@INC and what does it mean?
The sendmail.pm file is located in my cgi-bin as well. Why can't it find the sendmail.pm file?

Thanks,
Chuck
 
Perl can't find the module.
Try putting this at the top of your script:
(before the use Sendmail statment)
Code:
BEGIN { push @INC, '.' }
The @INC array is a special perl variable that contains a list of the paths perl searches when you try to include a file with 'use' or 'require'. Checkout "perldoc perlvar" for more special variables.

By pushing the dot (.) onto the array, we are adding one extra path to the @INC list. The . represents "Current Directory", which to your script would be whichever one it is running in. You could also replace the dot with an absolute path to the directory that contains your Sendmail.pm module:
Code:
BEGIN { push @INC, '/path/to/module' }
But since you indicated that your module and script were in the same directory, you could likely just use the dot. Make sure that you are being case-specific (upper/lower case letters) when 'use'ing your modules.

Hope this helps.

--jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top