LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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
 
Search this Thread
Old 05-09-2003, 06:34 AM   #1
chrisk5527
Member
 
Registered: Oct 2002
Location: Michigan
Distribution: Slackware Linux 10.0
Posts: 289

Rep: Reputation: 30
Running a shell script via CGI-BIN


Could someone give me directions on how to execute a shell script with Apache by clicking a button?
 
Old 05-09-2003, 07:01 AM   #2
mhearn
Guru
 
Registered: Nov 2002
Location: Durham, England
Distribution: Fedora Core 4
Posts: 1,565

Rep: Reputation: 47
That's a really bad idea. Shell scripts are ridiculously hard to make secure due to arcane quoting rules etc, you're better off using Perl for that, in which case there are lots of tutorials, FAQs etc on the net and the apache website.
 
Old 05-09-2003, 07:07 AM   #3
chrisk5527
Member
 
Registered: Oct 2002
Location: Michigan
Distribution: Slackware Linux 10.0
Posts: 289

Original Poster
Rep: Reputation: 30
Im inside of one of the most secure networks Ive ever seen, I honestly dont care how unsecure it is. So, how do you run a shell script with Apache by clicking a button. I just want directions, not criticism.
 
Old 05-09-2003, 11:44 AM   #4
mhearn
Guru
 
Registered: Nov 2002
Location: Durham, England
Distribution: Fedora Core 4
Posts: 1,565

Rep: Reputation: 47
You do it for bash the same way you'd do it for Perl - CGI is language neutral.

There are docs on httpd.apache.org for that. Basically:

create a standard script with the #! (shebang) line at the top.
make it +x
Add a cgi handler directive to the config file for the directory the file is in
Enable the CGI option in the config file (docs tell you how to do this)
In your web page put a form with the method attribute set to the path of the script on the webserver
 
  


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
cgi-bin script: turn off computer hamish Linux - General 2 10-21-2005 09:46 AM
Running perl scripts outside of cgi-bin ylikone Programming 1 09-08-2005 04:34 AM
trying to add cgi-bin perl script. shizzle Linux - Networking 7 05-19-2005 01:24 AM
#! does not seem to work in cgi-bin?? (script execution) servnov Linux - General 6 12-06-2004 07:23 AM
REMOTE_HOST in a CGI-bin script trouble gary knott Linux - Networking 4 11-12-2003 05:33 PM


All times are GMT -5. The time now is 11:00 PM.

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 Google+: linuxquestions
Open Source Consulting | Domain Registration