Red HatThis forum is for the discussion of Red Hat Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
The FormMail.cgi script returns an 'internal server' error as follows...
--------------------------------------------------------------------------------
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, root@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Apache/2.0.46 (Red Hat) Server at www.dtcglobal.com Port 80
--------------------------------------------------------------------------------
My root web directory is
/var/www/html
My cgi-bin directory is
/var/www/html/cgi-bin
The permissions on the directory and the FormMail.cgi file are rwxr_wr_w
The /etc/httpd/conf/httpd.conf file sets up the cgi-bin alias as follows
--------------------------------------------------------------------------------
LoadModule cgi_module modules/mod_cgi.so
...
<Directory "/var/www/html/cgi-bin">
AllowOverride All
Options ExecCGI
<IfModule mod_access.c>
Order allow,deny
Allow from all
</IfModule>
</Directory>
--------------------------------------------------------------------------------
My form executes the cgi as follows,
method="post" action="/cgi-bin/FormMail.cgi">
I get the error every time. Any ideas that can help me get this mail program running would be greatly appreciated.
I think you need to give them execute permission as well. Try CHMOD 755 whatever.cgi
I also suggest changing the name of that script to something a little less obvious, like my_mailer.cgi or something. The reason is, spammers have automated tools that will search for obvious names like "Formmail.cgi" because its very common. Still, security by obscurity is no solution, so if you can, try to change the script so it will only accept input from certain IPs (or whatever).
Here are the error messages from the error_log. The first is when I pointed to FormMail.cgi, and the second to FormMail.pl. I seem to get the same errors. The html forms that the errors claim do not exist, do exist.
[Fri Jan 28 13:45:03 2005] [error] [client 172.31.100.1] File does not exist: /var/www/html/Style Sheet, referer: http://www.dtcglobal.com/contact.html
[Fri Jan 28 13:45:05 2005] [error] [client 172.31.100.1] File does not exist: /var/www/html/Style Sheet, referer: http://www.dtcglobal.com/home.html
[Fri Jan 28 13:45:12 2005] [error] [client 172.31.100.1] (2)No such file or directory: exec of '/var/www/html/cgi-bin/FormMail.cgi' failed, referer: http://www.dtcglobal.com/home.html
[Fri Jan 28 13:45:12 2005] [error] [client 172.31.100.1] Premature end of script headers: FormMail.cgi, referer: http://www.dtcglobal.com/home.html
[Fri Jan 28 13:47:23 2005] [error] [client 172.31.100.1] File does not exist: /var/www/html/Style Sheet, referer: http://www.dtcglobal.com/contact.html
[Fri Jan 28 13:47:25 2005] [error] [client 172.31.100.1] File does not exist: /var/www/html/Style Sheet, referer: http://www.dtcglobal.com/home.html
[Fri Jan 28 13:47:31 2005] [error] [client 172.31.100.1] (2)No such file or directory: exec of '/var/www/html/cgi-bin/FormMail.pl' failed, referer: http://www.dtcglobal.com/home.html
[Fri Jan 28 13:47:31 2005] [error] [client 172.31.100.1] Premature end of script headers: FormMail.pl, referer: http://www.dtcglobal.com/home.html
Here is the cgi-bin directory contents.
/var/www/html/cgi-bin
[root@rh1 cgi-bin]# ls -l
total 68
-rwxr-xr-x 1 root root 29171 Jan 28 12:49 FormMail.cgi
-rwxrwxrwx 1 pkappaz root 29171 Jan 26 18:14 FormMail.pl
-rw-r--r-- 1 root root 8 Jan 28 13:16 test.txt
[root@rh1 cgi-bin]#
Dont make the permissions too loose. If you are running suexec on your apache, it will not let you execute scripts where the perms are too loose. Just do 755.
You can check to see if you're running suexec by looking for the suexec log. When you try to execute your script, it should show the user/group it tried to run as. It should also give you some info if it failed.
If you are running suexec, you should have suexecusergroup directive defined in your virtual host section that tells what user/group you want to execute scripts as. In that event, you'll need to chown your script to the user/group you have specified.
I doubt you're running all of this, but its good to eliminate this.
Hmmm... So did you find out if you are running suexec? Did you have any "suexecusergroup" directives listed in your virtual host stanza in the httpd.conf file??
If you did, then its a matter of chown'ing the script to the correct user. I don't recommend running as root. Definitely run the script as an unpriv user.
The only other thing that comes to mind would be problems with your script itself. It could be that you are using the wrong CR/LF for the script. Unix uses Line Feeds, not Carriage Returns. So if you have any in your script, it could be a problem. Do you have access to the command line? If so, run...
vi -b yourscript.cgi
and see if there are any ^M characters at the end of each line. If so, you'll need to remove those and try running the script again.
Sounds like you are using a text editor in Windows and saving your scripts to your unix drives. In that case, you can get a text editor like EditPlus (www.editplus.com) and they have the ability to change the format to either CR or LF. This is much easier than killing all those ^M's when viewing the file in binary mode.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.