Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum. |
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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
|
02-22-2003, 06:47 PM
|
#1
|
Member
Registered: Jan 2003
Distribution: RedHat Linux 9
Posts: 126
Rep:
|
perl not working again!!!
here's my situration.on httpd.conf,i enabled userdir and now i want to get cgi to work in the userdirs.i added this:
<Directory "/home/username/public_html">
Options All
AllowOverride None
</Directory>
then i tried installing coranto to test the script.and it gives me an error.i checked my error log and it says this:
Premature end of script headers: coranto.cgi
anyone know what i am doing wrong?
|
|
|
02-22-2003, 10:52 PM
|
#2
|
Senior Member
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,849
|
Re: perl not working again!!!
Quote:
Originally posted by dsgdevil
here's my situration.on httpd.conf,i enabled userdir and now i want to get cgi to work in the userdirs.i added this:
<Directory "/home/username/public_html">
Options All
AllowOverride None
</Directory>
then i tried installing coranto to test the script.and it gives me an error.i checked my error log and it says this:
Premature end of script headers: coranto.cgi
anyone know what i am doing wrong?
|
Have you seen the Apache manual section on CGI? Pay particular attention to the section ``But it's still not working.'' Especially if you're certain that all of the steps needed to allow user CGI (outlined in the previous few sections) have been taken. The most common problems that generate that kind of error message seem to be permissions (i.e., script not executable) and execution path problems (the environment the CGI script executes in is not the same as the one in which you wrote the script -- rule of thumb: fully qualify everything external that you want to invoke).
Hope this helps but if you're still unable to get things working, post your results and we'll take another crack at it.
Good luck,
Rick
|
|
|
02-22-2003, 11:54 PM
|
#3
|
Member
Registered: Jan 2003
Distribution: RedHat Linux 9
Posts: 126
Original Poster
Rep:
|
well,i checked my error log and it still says:
Premature end of script headers: test.cgi
Anyone know what that means?
|
|
|
02-23-2003, 12:55 AM
|
#4
|
Senior Member
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,849
|
Quote:
Originally posted by dsgdevil
well,i checked my error log and it still says:
Premature end of script headers: test.cgi
|
Can you post test.cgi? Have you made it executable (i.e., `chmod +x test.cgi')?
|
|
|
02-23-2003, 01:00 AM
|
#5
|
Member
Registered: Jan 2003
Distribution: RedHat Linux 9
Posts: 126
Original Poster
Rep:
|
#!/usr/bin/perl
print "Content-type: text/html\r\n\r\n";
print "Hello, World.";
and its chmoded to 755
|
|
|
02-23-2003, 01:15 AM
|
#6
|
Senior Member
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,849
|
Quote:
Originally posted by dsgdevil
#!/usr/bin/perl
print "Content-type: text/html\r\n\r\n";
print "Hello, World.";
|
Can't get much simpler than that. I cut-n-pasted this into testme.cgi in /var/www/cgi-bin and gave it the same permissions (755) and it works on my system. My Apache installation is the stock one setup by the installer. Have you tried that script in the default CGI directory? If it works then at least you can rule out the script, eh?
AND (dunno why I didn't think of this earlier)... have you uncommented the line:
AddHandler cgi-script .cgi
in /etc/httpd/conf/httpd.conf (it's about 80% of the way down from the top of file) and issued a `/etc/rc.d/init.d/httpd restart' command?
I'm betting that that line is still commented out in your config file.
Good luck,
Rick
|
|
|
02-23-2003, 12:01 PM
|
#7
|
Member
Registered: Jan 2003
Distribution: RedHat Linux 9
Posts: 126
Original Poster
Rep:
|
it works in the cgi-bin but i'm trying to make it work in the UserDir
like /home/user/public_html if i do that,in the httpd.conf,i added
<Directory "/home/user/public_html">
AllowOverride None
Options +ExecCGI +Includes
</Directory>
and that dosnt work.do i have to creat a cgi-bin?
|
|
|
02-23-2003, 09:24 PM
|
#8
|
Senior Member
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,849
|
Quote:
Originally posted by dsgdevil
it works in the cgi-bin but i'm trying to make it work in the UserDir
like /home/user/public_html
[snip]
and that dosnt work.do i have to creat a cgi-bin?
|
Creating the cgi-bin directory doesn't work either. I tried it both ways and no luck. There was something fairly incomprehensible on RedHat's bugzilla database about 2.0.40-11 having some problem involving CGI that was fixed in 2.0.44. I'd suggest looking into that or going back to the latest 1.3 release (1.3.26?). It's pretty frustrating to follow all the steps that the Apache folks themselves recommend and to come up empty. Makes me wonder if there isn't something broken in RedHat's binary. I'll look into grabbing 2.0.44 and compiling it to see what I get.
Anyone else run into this and find a fix somewhere?
|
|
|
02-24-2003, 12:10 AM
|
#9
|
Senior Member
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,849
|
dsgdevil,
I was able to get user directory CGI to work... after downloading Apache 2.0.44 and compiling. A simplified Directory section for user directories that looks like:
<Directory /home/*/public_html>
AllowOverride FileInfo AuthConfig Limit Indexes
Options Indexes IncludesNoExec ExecCGI
</Directory>
was sufficient to allow that simple perl CGI script to run. (I commented out the Limit and LimitExcept sections for my first test; the script stills runs with them back in place.)
Red Hat doesn't have an .rpm for this version (and neither does www.freshrpms.net) so you'd have to grab a copy from the Apache group's site or a mirror and compile it after removing 2.0.40-11 with `rpm -e'. This might mess up what you're doing with Apache if you were serving up pages via PHP scripts, etc. Getting PHP to work with this version might take a bit of work. I'll be doing that myself in the next few days and can post results of my adventure (unless the moderators object... in which case I could email them).
|
|
|
02-24-2003, 12:24 AM
|
#10
|
Member
Registered: Jan 2003
Distribution: RedHat Linux 9
Posts: 126
Original Poster
Rep:
|
that still dosnt work 
|
|
|
02-24-2003, 12:28 AM
|
#11
|
Senior Member
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,849
|
You are using the httpd that came from the RH8 CDs, right?
|
|
|
02-24-2003, 12:30 AM
|
#12
|
Member
Registered: Jan 2003
Distribution: RedHat Linux 9
Posts: 126
Original Poster
Rep:
|
yea
|
|
|
02-24-2003, 12:42 AM
|
#13
|
Senior Member
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,849
|
I only got CGI working out the standard /var/www/cgi-bin directory using that version. Getting ANYTHING except basic static web pages from a user directory just wasn't working. I suggest dumping RH's verson and upgrading. OR -- and I haven't tried this yet (and probably won't now that I got 2.0.44 ) -- you could grab the sources of the CDs and try compiling it yourself. Of course, it's possible that RH modified them such that you'd have a brand new copy of binaries that won't run CGI for users. If you want to take a crack at compiling a newer version, let me know and I think we can get you walked through it. It's not really that hard.
Later...
|
|
|
02-24-2003, 12:16 PM
|
#14
|
Member
Registered: Jan 2003
Distribution: RedHat Linux 9
Posts: 126
Original Poster
Rep:
|
will a .htaccess file help in any way?
|
|
|
02-24-2003, 03:13 PM
|
#15
|
Senior Member
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,849
|
Quote:
Originally posted by dsgdevil
will a .htaccess file help in any way?
|
I have used the .htaccess file to set up a directory with password protection. My experience is that it's not needed to allow CGI execution from a directory. It's not in 2.0.44 anyway. I tried a couple of settings in an .htaccess file with the stock httpd in RH8 (2.0.40-11) and it didn't seem to have any affect. I would think that if .htaccess were now required that the wailing and gnashing of teeth from the sysadmins that run systems with tons of virtual hosts (or have lots of users hosting web pages) would be deafening. The only conclusion I could come up with was that the httpd shipped with RH8 was semi-broken. (Well there's another conclusion -- that there's a screw loose on my system -- but I prefer not to think about that one. :-) )
|
|
|
All times are GMT -5. The time now is 11:22 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|