LinuxQuestions.org
Visit Jeremy's Blog.
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 03-08-2004, 04:20 PM   #1
clinton
Member
 
Registered: Oct 2003
Location: Vancouver
Distribution: RH Enterprise AS 3
Posts: 47

Rep: Reputation: 15
Configuring httpd.conf for CGI in Apache 2.x


I am having a lot of difficulty configuring httpd.conf to handle CGI, specifically having it work with /home/*/public_html/cgi-bin/. I am using RedHat 9.0.

I keep getting the error: "Premature end of script headers:"

I have checked the Apache FAQ and documentation and several forums, but none of the listed solutions have worked.

My httpd.conf (relevant part) file looks like this:

---code

ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"

<IfModule mod_cgid.c>
Scriptsock run/httpd.cgid
</IfModule>

<Directory "/var/www/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>

<Directory "/home/*/public_html">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>

AddHandler cgi-script cgi pl
<Directory "/home/*/public_html/cgi-bin">
AllowOverride None
Options +ExecCGI
Order allow,deny
Allow from all
</Directory>

---end code

I am not using "SetHandler cgi-script" because I want to be able to put .html files in that directory, when I did have it in I still got the same error.

I am testing with the following perl script:

--- code

#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "Hello, World.";

--- end code

The oddest thing is that in the /var/www/cgi-bin directory, this script actually works. But in my cgi-bin directory (~/public_html/cgi-bin) I get the header error. In addition, a script that I wrote a year ago (on different server - I changed the shebang line when I moved to this server) won't work in either directory.

Permissions to directories and files are all set to 655.

I am at a loss as to what the problem may be and hope I can get some suggestions.

Thanks.
 
Old 03-19-2004, 07:54 PM   #2
clinton
Member
 
Registered: Oct 2003
Location: Vancouver
Distribution: RH Enterprise AS 3
Posts: 47

Original Poster
Rep: Reputation: 15
Many headaches later, I have found a solution.

I had to re-install my Linux (using RedHat Enterprise now). The relevance will become evident below.

Several posts suggest /usr/sbin/suexec may be the culprit. For Enterprise, it apparently is. I moved it out of its directory, restarted the webserver, and voila! my troubles were over! (Just with a simple script, not sure about more complex ones)

I am 100% positive that suexec did NOT exist in my copy of RedHat 9.0, so I am not sure what the problem there was. Maybe it did exist and I never noticed.

Seems like a rather foolish idea to have suexec if it causes such a huge problem.
 
Old 01-01-2005, 01:13 AM   #3
sugob
LQ Newbie
 
Registered: Jan 2005
Posts: 1

Rep: Reputation: 0
I ran into this too with FC3... I had issues with accessing nagios cgi's in apache. I disabled SELinux in Security Settings and everything is working fine in now.

Last edited by sugob; 01-01-2005 at 02:26 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
apache httpd.conf ilnli Linux - Software 9 01-11-2005 06:58 AM
Apache httpd.conf help BoardinBum Linux - Software 4 12-29-2004 12:59 PM
Vqadmin.cgi, 403 Forbidden Erros, and httpd.conf woe opioid Linux - Software 3 05-11-2004 08:08 AM
httpd chokes on ScriptAlias line in Apache httpd.conf lhoff Linux - Software 1 07-14-2003 10:32 PM
apache httpd.conf plisken Linux - Software 1 02-01-2003 02:01 PM

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

All times are GMT -5. The time now is 03:29 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