LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 01-07-2004, 07:19 AM   #1
palanisaravanan
Member
 
Registered: Oct 2003
Location: India
Distribution: Debian
Posts: 95

Rep: Reputation: 15
Unhappy Apache cgi-script problem


I wrote a simple perl script (hello world) and put it into /usr/lib/cgi-bin.if i try to see the output by giving http://localhost/cgi-bin/hello.pl.,a new window opened and asking whether i want to save the file to disk or open it using any application.In errorlog there is no entry.I am a starter.forgive me for asking stupid qns like this.
 
Old 01-08-2004, 01:41 AM   #2
Technoslave
Member
 
Registered: Dec 2003
Location: Northern VA
Posts: 493

Rep: Reputation: 30
The following are things located in httpd.conf, the apache main config file.

ScriptAlias /cgi-bin/ "/usr/local/apache2/cgi-bin/"

Is /cgi-bin supposed to be located in /usr/lib? By default, it shouldn't be.

#
# "/usr/local/apache2/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/usr/local/apache2/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>

Likewise...by defualt, should be set to something like the above.
 
Old 01-08-2004, 03:22 AM   #3
palanisaravanan
Member
 
Registered: Oct 2003
Location: India
Distribution: Debian
Posts: 95

Original Poster
Rep: Reputation: 15
It is the same configuration i too have got.when i tried to restart apache In /var/log/messages i have found a error.NO such file or DIRECTORY:MOD_MIME_MAGIC:can't read magic file /etc/apache/share//magic.What is this?.Any thing realted with CGI execution??????.It is very confusing
 
Old 01-08-2004, 04:21 AM   #4
coolamit78
Member
 
Registered: Aug 2003
Location: New Delhi, India
Distribution: RHEL AS 3/4, Windows XP
Posts: 546

Rep: Reputation: 31
Hello....

Quote:

I wrote a simple perl script (hello world) and put it into /usr/lib/cgi-bin.if i try to see the output by giving http://localhost/cgi-bin/hello.pl.,a new window opened and asking whether i want to save the file to disk or open it using any application.In errorlog there is no entry.I am a starter.forgive me for asking stupid qns like this.
Ok....So if your httpd.conf has an entry like the line below .....

ScriptAlias /cgi-bin/ "/usr/local/apache2/cgi-bin/"

That means, it is aliasing the /cgi-bin directory to /usr/local/apache2/cgi-bin/

1. You can do one thing.....move your cgi-bin directory to the root directory (/cgi-bin)
and also check for the permissions too ..make sure they are set to 755

OR

2. As an Alternate way, you can change the default cgi-bin directory path to /usr/lib/cgi-bin ...this way, your ScriptAlias line will look like this..


ScriptAlias /cgi-bin/ "/usr/lib/cgi-bin/"

However, I recommend that you follow step (1)....

Regards,

amit
 
Old 01-08-2004, 06:52 AM   #5
palanisaravanan
Member
 
Registered: Oct 2003
Location: India
Distribution: Debian
Posts: 95

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by coolamit78
Hello....



Ok....So if your httpd.conf has an entry like the line below .....

ScriptAlias /cgi-bin/ "/usr/local/apache2/cgi-bin/"

That means, it is aliasing the /cgi-bin directory to /usr/local/apache2/cgi-bin/

1. You can do one thing.....move your cgi-bin directory to the root directory (/cgi-bin)
and also check for the permissions too ..make sure they are set to 755

OR

2. As an Alternate way, you can change the default cgi-bin directory path to /usr/lib/cgi-bin ...this way, your ScriptAlias line will look like this..


ScriptAlias /cgi-bin/ "/usr/lib/cgi-bin/"

However, I recommend that you follow step (1)....

Regards,

amit

Thanks.I tried it is also not working.I again the "save as dialog box" is opening.Well for ur ref I am pasting the entries in my httpd.conf

ScriptAlias /cgi-bin/ "/usr/lib/cgi-bin"

<Directory /usr/lib/cgi-bin>
AllowOverride none
options ExecCGI
order allow,deny
Allow from all
</Directory>
then i enabled
AddHandler cgi-script .cgi .sh .pl
LoadModule cgi_module /usr/lib/apache/1.3/modcgi.so.
--I am clueless.
 
Old 01-08-2004, 07:01 AM   #6
palanisaravanan
Member
 
Registered: Oct 2003
Location: India
Distribution: Debian
Posts: 95

Original Poster
Rep: Reputation: 15
when i am restaring apache in my /var/log/apache/error.log,I have found a error message.
[error]NO such file or directory:mod_mime_magic:can't read magic file /et/apache/share/magic
---What is this magig file.Any thing to do with CGI execution????
 
Old 02-07-2004, 09:41 AM   #7
spoody_goon
Member
 
Registered: Sep 2003
Location: Michigan USA
Distribution: Mandrake, DamnSmallLinux, VectorLinux
Posts: 416

Rep: Reputation: 30
I had the same problem. Check to be sure the path is right. I located a file /etc/webmin/perl-path which told me the path was /usr/bin/perl where I was using /usr/local/bin/perl I'm sure there is a way to put a link in /usr/local/bin/perl to /usr/bin/perl but I don't know how. Maybe someone else may know.
 
  


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
RH -> Debian migration breaks CGI script under Apache miggins Debian 1 09-02-2005 02:42 AM
CGI-script problem on Apache2 jkt2000 Linux - Networking 3 01-28-2005 04:38 AM
Probs running .jar file via CGI script under Apache blimbo Programming 1 07-22-2004 10:29 AM
Failed to execute cgi script in Apache!! baby_linu Linux - Newbie 4 06-30-2004 04:23 PM
Apache CGI Problem : Browser not running script Zaknafien Linux - Software 3 12-31-2003 01:16 PM

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

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