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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running CGI's from the user directories

Status
Not open for further replies.

utoyo

Technical User
Mar 5, 2005
123
0
0
US
I'm trying to allow users to run cgi programs from their public_html directories. I followed the directions at I checked the permissions but I'm still get "Premature end of script headers" and an Internal Server Error in the browser. I've tried printing the header as text and using CGI.pm.

What could I be missing?

Thanks in advance.
 
If it's a premature end of script, then the error is most likely in the script and not the Apache configuration. Do you have the line print "Content-type: text/html\n\n"; in your code?
 
You say you followed directions and checked permissions but didn't get very specific. You left us in a position to have to try to guess what you may have missed. Can you tell us what permissions are set for the scripts directory and the scripts themselves? Can you post the part of your httpd.conf that shows the directory container for the scripts directory? Are you running the perl interpreter or using the perl module? Did you compile this version of apache or is it the one that came with your distro? Which distro?
 
Using Fedora C4, apache and perl installed by the Fedora installer.
I have the public_html dir set to 755, above directories set to 711. Script permissions set to 755.

httpd.conf:
<Directory /home/*/public_html>
Options +ExecCGI
AddHandler cgi-script .cgi
</Directory>
 
I'm not too hip on scripts being in the same directory as html but you are using the correct directives to do the job so I'm not sure what the problem is. In most cases cgi scripts are set to 755 but there are some configurations where apache thinks these are executables. Try setting one of the scripts to 644 to turn of the x bit and see if that changes things. If all this fails, you will need to address the original error. The error message you are getting is saying that for some reason apache could not read the shebang (first line in the script). This could be due to many reasons such as a corrupt file. This can happen when you transfer a text file in binary mode or compressing a file on Windows and unzipping it on linux. The problem here is that there are end of line characters and carriage returns that don't belong. When apache tells the browser it can't serve the page, the browser doesn't care what the problem is, it just tells you that the server is misconfigured.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top