LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-11-2004, 06:00 PM   #1
sterrenkijker
Member
 
Registered: Mar 2004
Location: the Netherlands
Distribution: Debian Sarge
Posts: 302

Rep: Reputation: 30
cgi is displayed and not executed


Hello,

I'm a totally newbie on all server-like stuff. I've got set up a server, with a running website. Now I wanted a cgi-script on it. This is the page:

<html>

<head> <title> Test </title> </head>

<form method="post" action="script.cgi">
<input type="text" name="user" value="">
<input type=submit name=submitit>
</form>

<a href="script.cgi"> klik hier </a>

</html>

and this is the script:

#!/bin/bash

cat index.html

exit 0

and when I click the link to script.cgi or hit the submit button it only displays the content of the script. I have chmod +x it. At first I had another problem: my browser only wanted to download the script. Hitting the link from another computer gives the same result. I really don't get it anymore. I've spit through all tutorials over the web, and they only confuse me more. I'm out of inspiration. Can anyone help me out? How do I get a simple cgi-script working?

Corien
 
Old 06-11-2004, 09:25 PM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

You need to do two things (assuming your web server is Apache):

1. Put your CGI script in a *separate* directory from your HTML pages
EXAMPLE: /usr/local/httpd/cgi-bin

2. Modify your Apache httpd.conf file and assign a ScriptAlias to that directory:
EXAMPLE:
vi /usr/local/apache2/conf/httpd.conf =>
ScriptAlias /cgi-bin/ "/usr/local/apache2/cgi-bin/"

'Hope that helps .. PSM
 
Old 06-11-2004, 09:27 PM   #3
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

You need to do two things (assuming your web server is Apache):

1. Put your CGI script in a *separate* directory from your HTML pages
EXAMPLE: /usr/local/apache2/cgi-bin/

2. Modify your Apache httpd.conf file and assign a ScriptAlias to that directory:
EXAMPLE:
vi /usr/local/apache2/conf/httpd.conf =>
ScriptAlias /cgi-bin/ "/usr/local/apache2/cgi-bin/"

'Hope that helps .. PSM
 
Old 06-12-2004, 03:42 AM   #4
sterrenkijker
Member
 
Registered: Mar 2004
Location: the Netherlands
Distribution: Debian Sarge
Posts: 302

Original Poster
Rep: Reputation: 30
It worked! My own script still doesn't work, but there is a test-script which worked. Many thanks, you've helped me a lot further, now I can focus on one problem: my biggest problem was I had no idea where the mistake could be.

Corien
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get next executed line phuna Programming 2 07-08-2005 01:05 AM
CGI to work out side of cgi-bin? crashedspine Linux - Newbie 13 09-02-2004 09:49 PM
.bashrc not being executed, why? realos Linux - Newbie 1 12-20-2003 08:46 PM
.xinitrc isn't executed hampel Linux - Software 5 08-06-2003 04:53 AM
http://www.burstnet.com/cgi-bin/ads/ad7954a.cgi/3980/RETURN-CODE rverlander LQ Suggestions & Feedback 1 06-07-2002 08:35 AM


All times are GMT -5. The time now is 12:51 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration