LinuxQuestions.org
Visit Jeremy's Blog.
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
 
LinkBack Search this Thread
Old 10-30-2002, 09:13 PM   #1
Manuel Tejada
Member
 
Registered: Jun 2002
Location: Lima, PERU
Distribution: Red Hat
Posts: 35

Rep: Reputation: 15
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
 
Old 10-30-2002, 11:32 PM   #2
DavidPhillips
Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,153

Rep: Reputation: 56
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

Last edited by DavidPhillips; 10-30-2002 at 11:34 PM.
 
Old 10-31-2002, 08:50 AM   #3
daxy
Member
 
Registered: Oct 2002
Location: the Netherlands
Distribution: Debian - Sid
Posts: 33

Rep: Reputation: 15
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
 
Old 10-31-2002, 08:32 PM   #4
Manuel Tejada
Member
 
Registered: Jun 2002
Location: Lima, PERU
Distribution: Red Hat
Posts: 35

Original Poster
Rep: Reputation: 15
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
 
  


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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting CGI to work in apache jon_k Linux - Software 4 11-13-2004 04:06 PM
cgi won't work in apache davidk Linux - Networking 9 10-16-2004 07:09 AM
CGI to work out side of cgi-bin? crashedspine Linux - Newbie 13 09-02-2004 08:49 PM
C++ CGI Program(Tell Me what you think) karlan Programming 0 03-29-2004 01:33 PM
apache v2.0.44 + cgi ; securing cgi-support in apache markus1982 Linux - General 0 01-20-2003 01:03 PM


All times are GMT -5. The time now is 03:26 AM.

Main Menu
 
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
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration