Running cgi


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Running cgi
# 1  
Old 04-28-2005
Question Running cgi

I am learning about cgi and having lots of trouble. If I am on a server cs-srv2.(schoolname).edu and I want to run cgi script what would I need to do? By the way, I see [myusername@cs-srv2 myusername]$ on the command line when my server opens , if that makes a difference. I created a cgi-bin directory and put it in there. The script looks like:

Code:
#!/bin/csh
#Name: env.cgi
#Author: David Tansley
#Description: A script to display the envirinment variables.

echo "Content-type: text/html"
echo ""
echo "<HTML><PRE>"
echo "CGI test environments"
echo "SERVER_SOFTWARE = $SERVER_SOFTWARE"
echo "SERVER_NAME = $SERVER_NAME"
echo "GATEWAY_INTERFACE = $ GATEWAY_INTERFACE"
echo "SERVER_PROTOCOL = $SERVER_PROTOCOL"
echo "SERVER_PORT = $SERVER_PORT"
echo "REQUEST_METHOD = $REQUEST_METHOD"
echo "HTTP_ACCEPT = $HTTP_ACCEPT"
echo "PATH_INFO = $PATH_INFO"
echo "PATH_TRANSLATED = $PATH_TRANSLATED"
echo "QUERY_STRING = $QUERY_STRING"
echo "SCRIPT_NAME = $SCRIPT_NAME"
echo "REMOTE_HOST = $REMOTE_HOST"
echo "REMOTE_ADDR = $REMOTE_ADDR"
echo "REMOTE_USER = $REMOTE_USER"
echo "AUTH_TYPE = $AUTH_TYPE"
echo "CONTENT_TYPE = $CONTENT_TYPE"
echo "</PRE></HTML>"

# 2  
Old 04-29-2005
Roughly the set of things you should try:

(1) Ask your system administrator about whether you are allowed to run CGI scripts written in csh, or if you are allowed to run CGI scripts at all.
(2) Ask your system administrator where to put your CGI scripts. Every system is configured to place these files differently. On many servers, this is to place all the files in a public_html directory in your home directory, and CGIs are only allowed in a cgi-bin directory inside public_html.
(3) Give an executable chmod, e.g. 755, or do whatever is instructed by the system administrator with respect to site-specific configurations.

I think you need to ask your system administrator for most of these as only (s)he will know the configuration.
# 3  
Old 04-30-2005
I cant get into contact with him. He emailed me the cgi file so I know we can run them. He just never let ne know where to put them. I created the cgi-bin in the public_html directory and tried to see it with "cs-srv2.universityname.edu/home/myusername/public_html/cgi-bin/env.cgi" but it doesnt work. Am I referencing it correctly?

Last edited by CSGUY; 04-30-2005 at 03:45 PM.. Reason: Used unwanted info
# 4  
Old 04-30-2005
Maybe you try:

cs-srv2.universityname.edu/~myusername/cgi-bin/env.cgi

But after all, the exact URL to filesystem path mapping is really only known by the system administrator. A default Apache installation will be something similar to above, but not if he has changed the configuration.

I suppose many university CS depts will post the details of how to use their computing resources (including setting up CGI-BIN, if this is provided), possibly in your intranet or on the Web site of the department. Possibly he did not tell you because it has already been written somewhere in those pages.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

CGI Perl : while loop in CGI perl

Hi Team, I am trying to connect to database(succeeded ) and print the records on the browser using while loop. But the elements of array are not displayed instead while loop is displayed directly. Instead of the below I can embed html statements in print but I am looking for the below style as I... (1 Reply)
Discussion started by: scriptscript
1 Replies

2. Shell Programming and Scripting

Perl CGI : unable to download the excel sheet from perl cgi page

Hi All, I have written an cgi perl script that displays an image(Excel image) and when clicked on that Image I need to download a excel sheet. I made sure that excel sheet exists in the folder with the given name but still I am not able to download the sheet. print "<center><table... (2 Replies)
Discussion started by: scriptscript
2 Replies

3. Shell Programming and Scripting

Perl cgi pages out of cgi-bin folder in WINDOWS

Hi team, I have a typical problem with cgi pages in apache webserver in WINDOWS I am able to execute(display) the pages that are saved in cgi-bin folder. But I am not able to execute the pages stored in htdocs or other folder other than cgi-bin folder. Could anyone please let me know how... (1 Reply)
Discussion started by: scriptscript
1 Replies

4. Shell Programming and Scripting

CGI in Perl

Hi, Am unfamiliar with using CGI modules in Perl. Though i checked in few sites about CGI , i dint get a clear idea. Can anyone please explain me the purpose of these statements, it ll be very helpful to me #!/usr/bin/perl use CGI qw/:standard/; use Storable; use Data::Dumper; my... (1 Reply)
Discussion started by: irudayaraj
1 Replies

5. Web Development

problem with exporting vairable from one perl cgi to another perl cgi script while redirecting.

Can anyone tell me how to export a variable from one perl CGI script to another perl cgi script when using a redirect. Upon running the login.pl the user is prompted to enter user name and password. Upon entering the correct credentials (admin/admin) the user is redirected to welcome page. My... (3 Replies)
Discussion started by: Arun_Linux
3 Replies

6. Web Development

Need help with cgi and so on

Hello all, i`m new here and new in programming with cgi. But i need it for my running project. I`ve googled half a week with no success. All i need is to run an .sh-file via cgi. My file is stored in /home/bots/ but if i try #!/bin/sh echo 'Content-type: text/html' echo echo... (5 Replies)
Discussion started by: cryp0r
5 Replies

7. Solaris

apache ErrorDocument 400 /cgi-bin/400.cgi

Hi All, Sorry if the question is trivial for you but, I am new to Apache (2.0.63) and am trying to figure out how to display my 400.cgi. Here is what I have in httpd.conf servername testing DocumentRoot "/usr/local/apache2/htdocs" ErrorDocument 400 /cgi-bin/badrequest-400.cgi Here is... (0 Replies)
Discussion started by: afadaghi
0 Replies

8. Shell Programming and Scripting

running a cgi script even when browser is closed

hii, i have a cgi script file which may take some hours to complete. The script logs the output and mails the user. so the browser need not be open for the output. But currently the script dies off the instant the browser is closed or other pages are viewed. Is there a way out .. ? i have... (0 Replies)
Discussion started by: damn_bkb
0 Replies

9. Shell Programming and Scripting

CGI passing arrays/hashes to another CGI script

If I have a Perl CGI script (script01), which fills an array(s) with information and outputs a HTML page with a link to another CGI page (script02); is there anyway to pass the array(s) from "script01" to "script02" when the page visitor clicks the link? Hope that makes sense! :) (2 Replies)
Discussion started by: WIntellect
2 Replies

10. Shell Programming and Scripting

cgi

I am having trouble running my perl cgi on the Internet. After i put the cgi file into the public_html directory and try to browse it on the internet, it returns me the exact content of the cgi file. Is the file permission 755 for the cgi file correct? My path to perl is something like ... (2 Replies)
Discussion started by: vince
2 Replies
Login or Register to Ask a Question