LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   CGI program not work in Apache (https://www.linuxquestions.org/questions/linux-general-1/cgi-program-not-work-in-apache-34219/)

Manuel Tejada 10-30-2002 09:13 PM

CGI program not work in Apache
 
Hi
I use RedHat 7.2 in a PC workstation not for production, just for homework.
This is the first time working with Apache. It is working fine with html pages, but not with cgi programs.
I buil the following text cgi program called "mi_cgi.pl" in my home
directory /home/manuel/ and then copy it to /var/www/cgi-bin :

#! /usr/bin/perl
print "Content-Type: text\html\r\n\r\n";
print "Hola, Manuel.";

When I enter the direction http://localhost/cgi-bin/mi_cgi.pl in Netscape I don't see the line "Hola, Manuel", instead of that a windows appear asking to save the mi_cgi.pl file in my home directory. This window has the following spaces:
Filter: /home/manuel/*.pl
Selection: /home/manuel/mi_cgi.pl
And three buttoms: "Accept", "Filter" and "Cancel"

When I click Accept and then goes to Netscape to try again see the output of the cgi program the same window appear again.

I don't know why this is happens.
When I ejecute the cgi program in command line I get the output, then the sintax is OK.
I gave everyone permission on the file.
The path to the script interpreter is OK.

What I am doing wrong?
I will appreciate any help

DavidPhillips 10-30-2002 11:32 PM

not really sure, but mine have a filename ending in .cgi

this is the default

httpd.conf

AddHandler cgi-script .cgi

Also...

for CGI scripts outside of ScriptAliased directories:
add "ExecCGI" to the "Options" directive

daxy 10-31-2002 08:50 AM

You can also try to add the folowing line:
ScriptAlias /cgi-bin/ /usr/local/apache/share/cgi-bin/

replace /usr/local/apache/share/cgi-bin/ with your cgi-bin directory of cource :)

Manuel Tejada 10-31-2002 08:32 PM

Thank Daxy and David for your answer.

But my fault was error sintax.

In line 1 would no be space betwen "!" and path to the interpreter.
In line the slash betwen "text" and "html" must be "/" and not "\".

I made the correction and it works


All times are GMT -5. The time now is 05:29 AM.