LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-12-2017, 07:21 PM   #16
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: Rocky 9.5
Posts: 5,826

Rep: Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251

Quote:
Originally Posted by phipm1 View Post
I'm still trying to get Formmail to work. So I have built a basic web server but still getting no where.

Why would I be getting error

[Mon Jun 12 14:59:43 2017] [error] [client 10.226.40.1:62454] File does not exist: /htdocs/michelle2/htdocs, referer: http://thesourceqa.stholdco.com/

/htdocs/michelle2 is the doc root of the webserver where would it be picking up the 2nd htdocs from?

directory is this, as well as the html files
What does the <form> tag in the calling web page say? From the error, I'd guess it's something like
<form method="POST" action="/htdocs"> ... but please post what it actually contains.

You previously showed us
Code:
[error] (2)No such file or directory: exec of '/cgi-bin/FormMail.cgi' failed
[error] Premature end of script headers: FormMail.cgi, referer: http://xxx.domain.com/corp/tools/feedback.htm
This new error is different, being called from a different web page (presumably an index.htm...unless you are editing the actual error you're getting to sanitize it), which is OK in principle, but can make it difficult to help you.

"File does not exist" is what you'll get if the form tag doesn't contain a valid path to and/or name of an executable script.
The earlier error of "No such file..." followed by "Premature end..." is, again, probably caused by a munged/incorrect #! line.

Last edited by scasey; 06-12-2017 at 09:25 PM.
 
Old 06-13-2017, 09:09 AM   #17
phipm1
LQ Newbie
 
Registered: May 2017
Posts: 20

Original Poster
Rep: Reputation: Disabled
/bin/perl
 
Old 06-13-2017, 09:59 AM   #18
phipm1
LQ Newbie
 
Registered: May 2017
Posts: 20

Original Poster
Rep: Reputation: Disabled
The file is there with the correct permissions but yet I'm getting this error

[Tue Jun 13 07:50:34 2017] [error] [client 142.164.103.69:50122] File does not exist: /htdocs/michelle2/htdocs, referer: http://ipaddress/test.html


FormMail.cgi is located in /htdocs/cgi-bin/

THIS IS test.html PAGE
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>formtest</title>
<style type="text/css">
body {
background-color: #CF9;
}
</style>
</head>

<body>

<form action="/htdocs/cgi-bin/FormMail.cgi" method="post" name="form1" id="form1">
<table width="95%" border="0" align="center" cellpadding="5" cellspacing="0" bordercolor="#000000" class="layout_table">
<tr>
<td colspan="2" class="table_heading_complex">Your Information</td>
</tr>
<tr>
<td width="30%" class="content_body">Your name</td>
<td width="70%"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><span class="content_secondary">First *</span><br />
<input name="Your_Name" type="text" id="Your_Name" size="27"/></td>
<td><span class="content_secondary">Last *</span><br />
<input name="Last_Name" type="text" id="Last_Name" size="45"/></td>
</tr>
</table></td>
</tr>
<tr>
<td bgcolor="f4f4f4" class="content_body">Your work e-mail address</td>
@
"test.html" 65L, 3429C


THIS IS THE CONF FILE
#
#############################################################################
Include /opt/IBM/WebSphere/HTTPServer/conf/httpd.conf
LoadModule include_module /opt/IBM/WebSphere/HTTPServer/modules/mod_include.so
#############################################################################
#
#Listen IP address and Port Number
#
Listen ipaddress:80

### Document Root########

DocumentRoot "/htdocs/michelle2"
#
<Directory />
Options Indexes FollowSymLinks +ExecCGI +Includes
XBitHack full
AllowOverride None
Order allow,deny
Allow from all
</Directory>

<Directory /htdocs/michelle2/>
Options Indexes FollowSymLinks +ExecCGI +Includes
XBitHack full
AllowOverride None
Order allow,deny
Allow from all
</Directory>


######### DirectoryIndex ############################################
#
DirectoryIndex index.html test.html
IndexOptions FancyIndexing VersionSort

#
############ Pid, Error and Access Logs ##################################

PidFile /webspherelogs/sls0622/web/michelle2/httpd.pid
ErrorLog "|/opt/IBM/WebSphere/HTTPServer/bin/rotatelogs /webspherelogs/sls0622/web/michelle2/error_%Y%m%d 86400 -360"
CustomLog "|/opt/IBM/WebSphere/HTTPServer/bin/rotatelogs /webspherelogs/sls0622/web/michelle2/access_%Y%m%d 86400 -360" common env=!dontlog

LogLevel warn
#
#
# The following directives define some format nicknames for use with a CustomLog directive (see below).
#
LogFormat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i"%D\%X" combined
LogFormat "%h %l %u %t "%r" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
#
#
################### CGI #############################################
#
ScriptAlias /cgi-bin "/htdocs/cgi-bin"
ScriptAlias /cgi "/htdocs/cgi-bin"

AddHandler cgi-script .cgi .pl

<Directory "/htdocs/cgi-bin/">
Options Indexes FollowSymLinks +ExecCGI +Includes
XBitHack full
AllowOverride None
Order allow,deny
Allow from all

</Directory>

############# To parse .shtml files for server-side includes (SSI):
## (You will also need to add "Includes" to the "Options" directive.)
#
#
AddType text/html .shtml .html .htm
AddOutputFilter INCLUDES .shtml .html .htm
 
Old 06-13-2017, 10:36 AM   #19
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: Rocky 9.5
Posts: 5,826

Rep: Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251
Quote:
Originally Posted by phipm1 View Post
/bin/perl
So the #! line is not correct, as you previously posted that it was
Code:
#!/usr/bin/perl
Either change the #! in the script or make a link from /usr/bin/perl to /bin/perl
 
Old 06-13-2017, 10:44 AM   #20
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: Rocky 9.5
Posts: 5,826

Rep: Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251
Quote:
Originally Posted by phipm1 View Post
The file is there with the correct permissions but yet I'm getting this error

[Tue Jun 13 07:50:34 2017] [error] [client 142.164.103.69:50122] File does not exist: /htdocs/michelle2/htdocs, referer: http://ipaddress/test.html


FormMail.cgi is located in /htdocs/cgi-bin/

THIS IS test.html PAGE
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>formtest</title>
<style type="text/css">
body {
background-color: #CF9;
}
</style>
</head>

<body>

<form action="/htdocs/cgi-bin/FormMail.cgi" method="post" name="form1" id="form1">
<table width="95%" border="0" align="center" cellpadding="5" cellspacing="0" bordercolor="#000000" class="layout_table">
<tr>
<td colspan="2" class="table_heading_complex">Your Information</td>
</tr>
<tr>
<td width="30%" class="content_body">Your name</td>
<td width="70%"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><span class="content_secondary">First *</span><br />
<input name="Your_Name" type="text" id="Your_Name" size="27"/></td>
<td><span class="content_secondary">Last *</span><br />
<input name="Last_Name" type="text" id="Last_Name" size="45"/></td>
</tr>
</table></td>
</tr>
<tr>
<td bgcolor="f4f4f4" class="content_body">Your work e-mail address</td>
@
"test.html" 65L, 3429C


THIS IS THE CONF FILE
#
#############################################################################
Include /opt/IBM/WebSphere/HTTPServer/conf/httpd.conf
LoadModule include_module /opt/IBM/WebSphere/HTTPServer/modules/mod_include.so
#############################################################################
#
#Listen IP address and Port Number
#
Listen ipaddress:80

### Document Root########

DocumentRoot "/htdocs/michelle2"
#
<Directory />
Options Indexes FollowSymLinks +ExecCGI +Includes
XBitHack full
AllowOverride None
Order allow,deny
Allow from all
</Directory>

<Directory /htdocs/michelle2/>
Options Indexes FollowSymLinks +ExecCGI +Includes
XBitHack full
AllowOverride None
Order allow,deny
Allow from all
</Directory>


######### DirectoryIndex ############################################
#
DirectoryIndex index.html test.html
IndexOptions FancyIndexing VersionSort

#
############ Pid, Error and Access Logs ##################################

PidFile /webspherelogs/sls0622/web/michelle2/httpd.pid
ErrorLog "|/opt/IBM/WebSphere/HTTPServer/bin/rotatelogs /webspherelogs/sls0622/web/michelle2/error_%Y%m%d 86400 -360"
CustomLog "|/opt/IBM/WebSphere/HTTPServer/bin/rotatelogs /webspherelogs/sls0622/web/michelle2/access_%Y%m%d 86400 -360" common env=!dontlog

LogLevel warn
#
#
# The following directives define some format nicknames for use with a CustomLog directive (see below).
#
LogFormat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i"%D\%X" combined
LogFormat "%h %l %u %t "%r" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
#
#
################### CGI #############################################
#
ScriptAlias /cgi-bin "/htdocs/cgi-bin"
ScriptAlias /cgi "/htdocs/cgi-bin"

AddHandler cgi-script .cgi .pl

<Directory "/htdocs/cgi-bin/">
Options Indexes FollowSymLinks +ExecCGI +Includes
XBitHack full
AllowOverride None
Order allow,deny
Allow from all

</Directory>

############# To parse .shtml files for server-side includes (SSI):
## (You will also need to add "Includes" to the "Options" directive.)
#
#
AddType text/html .shtml .html .htm
AddOutputFilter INCLUDES .shtml .html .htm
OK. if DocumentRoot is /htdocs/michelle2 then files in /htdocs/cgi-bin are NOT in the defined webspace. Either change the document root to /htdocs and restart apache OR move the contents of /htdocs/cgi-bin to /htdocs/michelle2/cgi-bin.

And that's where the extra htdocs/ comes from in the error message. The page is calling (DocumentRoot)/htdocs/cgi-bin/FormMail.cgi, which becomes /htdocs/michelle2/htdocs/cgi-bin/FormMail.cgi -- which does not exist. So "File not found"

Last edited by scasey; 06-13-2017 at 10:46 AM.
 
Old 06-13-2017, 10:50 AM   #21
phipm1
LQ Newbie
 
Registered: May 2017
Posts: 20

Original Poster
Rep: Reputation: Disabled
Thanks Sean

I originally had the cgi file in the doc root but was getting error Premature end of script headers: SKFormMail_original.cgi
 
Old 06-13-2017, 11:00 AM   #22
phipm1
LQ Newbie
 
Registered: May 2017
Posts: 20

Original Poster
Rep: Reputation: Disabled
So now I'm getting (104)Connection reset by peer: Failed to flush CGI output to client, error.
 
Old 06-13-2017, 11:11 AM   #23
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: Rocky 9.5
Posts: 5,826

Rep: Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251
Quote:
Originally Posted by phipm1 View Post
Thanks Sean

I originally had the cgi file in the doc root but was getting error Premature end of script headers: SKFormMail_original.cgi
Again, that's because the #! line wasn't correct.

You are most welcome.
 
Old 06-13-2017, 11:17 AM   #24
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: Rocky 9.5
Posts: 5,826

Rep: Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251
Quote:
Originally Posted by phipm1 View Post
So now I'm getting (104)Connection reset by peer: Failed to flush CGI output to client, error.
Please tell us what you've changed and where. And maybe why in case it's not obvious to us.
 
Old 06-13-2017, 11:54 AM   #25
phipm1
LQ Newbie
 
Registered: May 2017
Posts: 20

Original Poster
Rep: Reputation: Disabled
All I changed was the form action path. pointing to the doc root instead of the /htdocs/cgi-bin
 
Old 06-13-2017, 02:46 PM   #26
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: Rocky 9.5
Posts: 5,826

Rep: Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251
Quote:
Originally Posted by phipm1 View Post
All I changed was the form action path. pointing to the doc root instead of the /htdocs/cgi-bin
So now it says
Code:
<form action="/cgi-bin/FormMail.cgi" method="post"...
yes?
I presume you also changed the #! line to
Code:
#!/bin/perl
in the FormMail.cgi script.

I did a cursory review of the results of a web search for "apache (104)Connection reset by peer:" and saw several issues referenced from httpd configuration problems to networking issues. It might be useful to you to look into those and see which seem to fit your case.

I have never seen that error before...so don't have anything more to add. Sorry.

Aha!
I note that you have references to /htdocs/cgi-bin in your httpd.conf
Code:
ScriptAlias /cgi-bin "/htdocs/cgi-bin"
ScriptAlias /cgi "/htdocs/cgi-bin"

AddHandler cgi-script .cgi .pl

<Directory "/htdocs/cgi-bin/">
Options Indexes FollowSymLinks +ExecCGI +Includes
XBitHack full
AllowOverride None
Order allow,deny
Allow from all

</Directory>
-- if those are still there, that might contribute. Again, that location for cgi-bin is not visible to the web server if the DocumentRoot is /htdocs/michelle2

Last edited by scasey; 06-13-2017 at 02:53 PM.
 
Old 06-16-2017, 12:19 PM   #27
phipm1
LQ Newbie
 
Registered: May 2017
Posts: 20

Original Poster
Rep: Reputation: Disabled
So now I've finally got Formail, mailing. I get my thank you reply in browser

but now I'm getting Template not found /templates/testfeedback.html in the recipient email and sender email. The directory and files have the correct permissions and ownership.

There are no errors in the log files (woohoo!)


<td colspan="2"><div align="center">
<input type="hidden" name="recipient" value="webserver.admins@xxx.com"/>
<input type="hidden" name="subject" value="Source Feedback"/>
<input type="hidden" name="template_name" value="/templates/testfeedback.html"/>
<input type="hidden" name="required" value="Your_Name, Last_Name, YOUR_EMAIL, Feedback"/>
<input type="hidden" name="redirect" value="http://thesourceqa.stholdco.com/testreply.html"/>
<input type="hidden" name="email_format" value="html"/>
</div>

I've tried using ../templates/testfeedback.html and ../testfeedback.html still get the same exact error in email. Template not found /templates/testfeedback.html

I've added directory path to the conf file

<Directory /htdocs/formtest2/templates/>
Options Indexes FollowSymLinks +ExecCGI +Includes
XBitHack full
AllowOverride None
Order allow,deny
Allow from all
</Directory>

still the same error with out without the added directory

Last edited by phipm1; 06-16-2017 at 12:20 PM.
 
Old 06-16-2017, 01:34 PM   #28
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: Rocky 9.5
Posts: 5,826

Rep: Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251
I'm glad you've got the script working now, Michelle. If you would briefly recap what you did to make that work, that would help others who might have the same problem.

About the new question:
Where is testfeedback.html actually located? If you haven't changed the DocumentRoot, it would need to be in /htdocs/michelle2/templates/
If you haven't changed the DocumentRoot, /htdocs/formtest2/templates/ is not in the defined web space.

What would you enter in a browser to see that page?

Incidentally, an additional <Directory...> specification is not usually necessary except to allow script execution (ExecCGI), authorization, or to change the allow,deny order (there are probably other reasons to do it, but finding a lost file isn't one of them). Defining a Directory specification outside the web space has no effect or meaning.

Last edited by scasey; 06-16-2017 at 01:36 PM.
 
Old 06-16-2017, 01:45 PM   #29
phipm1
LQ Newbie
 
Registered: May 2017
Posts: 20

Original Poster
Rep: Reputation: Disabled
The problem with Formmail.cgi not working is server people changed the permissions on the drive that was not allowing me to have form mail set at 755 which it was originally but got changed somehow. gremlins maybe who knows

testfeedback.html is located in the templates directory which is in the doc root formtest2

/formtest2/templates/
 
Old 06-16-2017, 01:50 PM   #30
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: Rocky 9.5
Posts: 5,826

Rep: Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251Reputation: 2251
Quote:
Originally Posted by phipm1 View Post
The problem with Formmail.cgi not working is server people changed the permissions on the drive that was not allowing me to have form mail set at 755 which it was originally but got changed somehow. gremlins maybe who knows

testfeedback.html is located in the templates directory which is in the doc root formtest2

/formtest2/templates/
...so you have changed the DocumentRoot in http.conf to /formtest2 from what it was: /htdocs/michelle2? And restarted apache?

Last edited by scasey; 06-16-2017 at 01:51 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Premature End of Script Headers yuri16 Linux - Newbie 3 05-26-2009 04:03 AM
Premature end of script headers: CGI fatturi Linux - Newbie 4 07-19-2007 05:55 PM
Premature end of script headers bhomass Debian 1 12-02-2005 06:31 PM
Premature end of script headers webhead Red Hat 5 09-22-2004 02:56 AM
Perl/CGI Problem "Premature Premature end of script headers: countdown.pl" newuser455 Linux - Software 2 07-18-2004 12:47 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:54 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration