LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-15-2002, 02:37 PM   #1
robgo777
Member
 
Registered: Nov 2002
Posts: 35

Rep: Reputation: 15
proplems with apache


I have apache-1.3.23.11 and for some reason it wont let me execute scripts with a .cgi extension. It will only let me execute .pl files as cgi scripts.

I have already edited the httpd.conf file and added the line:

AddHandler cgi-script cgi

But still no luck. Any help would be greatly appreciated.

Robert
 
Old 12-15-2002, 06:08 PM   #2
DavidPhillips
LQ Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,163

Rep: Reputation: 58
what are the permissions set on the files
 
Old 12-15-2002, 07:24 PM   #3
Syncrm
Member
 
Registered: Aug 2001
Location: Lansing, Michigan
Distribution: slackware8+
Posts: 472

Rep: Reputation: 30
try putting a . in front of cgi:

AddHandler cgi-script .cgi

might also wanna try an "Options ExecCGI" in your httpd.conf file as well.
 
Old 12-15-2002, 09:14 PM   #4
robgo777
Member
 
Registered: Nov 2002
Posts: 35

Original Poster
Rep: Reputation: 15
Thanks guys so far. Yeah, I have the files set for 0755. If I change the extension to .pl, then they work fine. But if they are .cgi, then it doesn't work

I tried both .cgi and cgi for the AddHandler. And I already have the following tag in my httpd.conf:

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

Any other suggestions??

Thanks,

Robert
 
Old 12-16-2002, 02:35 PM   #5
SlickWilly
Member
 
Registered: Dec 2002
Posts: 327

Rep: Reputation: 30
D'you have an error message you can post?

/var/log/httpd/error_log

Or um.. wherever you put your logs..

Slick.
 
Old 12-17-2002, 12:10 PM   #6
robgo777
Member
 
Registered: Nov 2002
Posts: 35

Original Poster
Rep: Reputation: 15
Slick,

The error is:

Premature end of script headers: /var/www/cgi-bin/msingles2/install.cgi

Thanks,

Rob
 
Old 12-17-2002, 12:15 PM   #7
DavidPhillips
LQ Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,163

Rep: Reputation: 58
that sounds like an error in the script
 
Old 12-17-2002, 12:39 PM   #8
robgo777
Member
 
Registered: Nov 2002
Posts: 35

Original Poster
Rep: Reputation: 15
Okay, I have fixed it. I don't know what I did, but I modified something in my script, it worked, so then I put it back the way it was and it still works! Who knows!

Thanks everyone.

Robert
 
Old 12-17-2002, 12:59 PM   #9
Creep
LQ Newbie
 
Registered: Dec 2002
Distribution: Gentoo & Debian
Posts: 25

Rep: Reputation: 15
the question is, why did it work as a .pl-file but not as a .cgi-file? does perl handle .cgi in a different way than normal .pl-files?
 
Old 12-17-2002, 01:06 PM   #10
SlickWilly
Member
 
Registered: Dec 2002
Posts: 327

Rep: Reputation: 30
Urm.. yeah, it's not an apache problem it's a script problem.

I'd hazard a guess that your script was 'copied' over somewhere in binary form instead of ascii, or that it was moved from a windoze machine to a unix machine using shares.

Either will stuff the 'ascii-ness' of your script, and the windoze move will render the script readable, but there are hidden characters at the ends of the lines which will stuff apache's ability to execute it.

There are a couple of work-arounds.
1) copy the text of the script, create new script on unix machine & paste script into vi(m) window.
2) run a dos2ascii converter over your scripts - they remove the extra characters off the end of the line and make it unix proper...

you can find 2) on your system :

/usr/bin/unix2dos
/usr/bin/dos2unix

[edit]

There's also the possibilty that you didn't specify the shell as the first line of the script. Something like :

#!/usr/bin/perl

I can't remember if that will give you the above error, mind you.

Last edited by SlickWilly; 12-17-2002 at 01:09 PM.
 
Old 12-21-2002, 05:31 PM   #11
robgo777
Member
 
Registered: Nov 2002
Posts: 35

Original Poster
Rep: Reputation: 15
I will look into the dos2unix program. How would I use it to check my scripts?

Thanks,

Robert
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Proplems on reboot after install Debian sarge potterpoole Linux - Newbie 11 04-13-2005 04:04 PM
Gnome proplems at start up klunk Linux - Newbie 3 02-13-2005 12:58 PM
proplems starting ut2004 in fedora pepsi Linux - Games 1 06-03-2004 11:43 AM
Proplems with mounted drive permissions Davschm Linux - Newbie 2 09-15-2002 05:35 PM
Proplems start MySQL server... Simon W Linux - General 1 03-09-2002 04:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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