LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-06-2006, 02:20 PM   #1
indienick
Senior Member
 
Registered: Dec 2005
Location: London, ON, Canada
Distribution: Arch, Ubuntu, Slackware, OpenBSD, FreeBSD
Posts: 1,853

Rep: Reputation: 65
CGI/Perl


I'm trying to set up a CGI script for a business website, and I'm testing them on my home computer before I upload them. Problem is, when I set the link in the html page like so <a href="./script.cgi?variable">link</a> and when I click on the link, I get an option to download the file, not view the output.

Do I need to set my box up as an Apache server to run CGI-scripts locally? Or am I just not doing something right in the script?

I tried a simple script:
Code:
#!/usr/bin/perl -wT
print "Content-type: text/html\n\n";
print "Hello, world.\n";
But, again, running it, I get the download option.
 
Old 03-06-2006, 03:00 PM   #2
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
The web server runs cgi scripts, not a web browser. In order to get the cgi script to execute, it must be installed in the cgi-bin directory of a running web server. Your link looks like it would point to a document directory, which is probably not correct, even where there is a running web server.

--- rod.
 
Old 03-06-2006, 03:16 PM   #3
indienick
Senior Member
 
Registered: Dec 2005
Location: London, ON, Canada
Distribution: Arch, Ubuntu, Slackware, OpenBSD, FreeBSD
Posts: 1,853

Original Poster
Rep: Reputation: 65
thanks for the reply man, but I figured it out. I threw the files into the appropriate folders in /var/www/ and everything's working smoothly now =)
 
  


Reply



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
Perl CGI:Can't locate CGI.pm supermyself Programming 13 09-10-2007 06:22 AM
executing perl cgi DanTaylor Programming 4 09-21-2006 06:54 PM
perl cgi neil Programming 3 07-07-2004 04:52 AM
cgi perl : I cant get perl to append my html file... the_y_man Programming 3 03-22-2004 05:07 AM
cgi+perl barbanero General 0 04-07-2002 12:48 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

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