LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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


Reply
  Search this Thread
Old 02-22-2003, 06:47 PM   #1
dsgdevil
Member
 
Registered: Jan 2003
Distribution: RedHat Linux 9
Posts: 126

Rep: Reputation: 15
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?
 
Old 02-22-2003, 10:52 PM   #2
rnturn
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,801

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
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
 
Old 02-22-2003, 11:54 PM   #3
dsgdevil
Member
 
Registered: Jan 2003
Distribution: RedHat Linux 9
Posts: 126

Original Poster
Rep: Reputation: 15
well,i checked my error log and it still says:
Premature end of script headers: test.cgi
Anyone know what that means?
 
Old 02-23-2003, 12:55 AM   #4
rnturn
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,801

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
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')?
 
Old 02-23-2003, 01:00 AM   #5
dsgdevil
Member
 
Registered: Jan 2003
Distribution: RedHat Linux 9
Posts: 126

Original Poster
Rep: Reputation: 15
#!/usr/bin/perl
print "Content-type: text/html\r\n\r\n";
print "Hello, World.";
and its chmoded to 755
 
Old 02-23-2003, 01:15 AM   #6
rnturn
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,801

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
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
 
Old 02-23-2003, 12:01 PM   #7
dsgdevil
Member
 
Registered: Jan 2003
Distribution: RedHat Linux 9
Posts: 126

Original Poster
Rep: Reputation: 15
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?
 
Old 02-23-2003, 09:24 PM   #8
rnturn
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,801

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
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?
 
Old 02-24-2003, 12:10 AM   #9
rnturn
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,801

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
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).
 
Old 02-24-2003, 12:24 AM   #10
dsgdevil
Member
 
Registered: Jan 2003
Distribution: RedHat Linux 9
Posts: 126

Original Poster
Rep: Reputation: 15
that still dosnt work
 
Old 02-24-2003, 12:28 AM   #11
rnturn
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,801

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
You are using the httpd that came from the RH8 CDs, right?
 
Old 02-24-2003, 12:30 AM   #12
dsgdevil
Member
 
Registered: Jan 2003
Distribution: RedHat Linux 9
Posts: 126

Original Poster
Rep: Reputation: 15
yea
 
Old 02-24-2003, 12:42 AM   #13
rnturn
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,801

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
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...
 
Old 02-24-2003, 12:16 PM   #14
dsgdevil
Member
 
Registered: Jan 2003
Distribution: RedHat Linux 9
Posts: 126

Original Poster
Rep: Reputation: 15
will a .htaccess file help in any way?
 
Old 02-24-2003, 03:13 PM   #15
rnturn
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,801

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
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. :-) )
 
  


Reply



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
cant get perl working with apache2 Garda Linux - Networking 1 09-28-2005 10:27 PM
perl 5.87 debugger not working techy613 Linux - Software 0 08-08-2005 02:54 PM
my perl is not working, please help me rhuser Linux - Software 7 03-14-2003 01:12 PM
cant get perl working dsgdevil Linux - Software 2 02-12-2003 08:18 PM
Perl>>working with strings format_c Programming 2 11-15-2001 04:21 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:49 PM.

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