LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Apache cgi-script problem (https://www.linuxquestions.org/questions/linux-general-1/apache-cgi-script-problem-132353/)

palanisaravanan 01-07-2004 07:19 AM

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.

Technoslave 01-08-2004 01:41 AM

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.

palanisaravanan 01-08-2004 03:22 AM

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

coolamit78 01-08-2004 04:21 AM

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

palanisaravanan 01-08-2004 06:52 AM

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.

palanisaravanan 01-08-2004 07:01 AM

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????

spoody_goon 02-07-2004 09:41 AM

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.


All times are GMT -5. The time now is 09:59 AM.