Lunarpages Web Hosting Forum

Author Topic: First time with CGI  (Read 8278 times)

Offline Kendall

  • Intergalactic Superstar
  • *****
  • Posts: 137
    • http://www.kendallepark.com
First time with CGI
« on: May 24, 2003, 06:59:11 PM »
Hey all i wanted to work with a cgi script i got from hotscripts.com but have no clue what to do! i read the readme but still cant figure it out!!!!!

http://www.directcgi.com/randomquote.html

thats the script i want to use but not sure what to do

if somebody could help me email me or AIM me ICQ or what ever anyhelp i would love thanks!!!!

the only thing im kinda lost with is this it says to edit the first line and the first line is this

#!/usr/bin/perl

what do i change?

where do i upload in the cgi-bin dir? or make other dirs in it with user/bin/perl ?

or what

ahhhhhhhhhhhh im lost!

Offline Ed

  • Berserker Poster
  • *****
  • Posts: 5156
    • Joke A Whenever
First time with CGI
« Reply #1 on: May 24, 2003, 10:11:53 PM »
That is the location to PERL on the server you are on.

If you log into CPanel, you should see a line that says the location to perl on your server near the bottom left on the side bar.

It might be something like above, or: #!/usr/local/bin/perl

Then upload the script in ASCII mode! (NOT Binary!). CHMOD (change the permissions) to whatever the readme.txt file instructs (probably 755).

For starters, try uploading to just the plain old cgi-bin/ directory.

Should work.

You do not need to make new directories etc. Just make sure that first line is
#!location-of-perl
you may not even have to change anything!

If my broad suggestions are of no use, let me know and I'll write up a step by step for you as soon as I get a chance!

Just wanted to give you a quick answer to try and point you in the right direction :-)

Good Luck!
- Ed :-)

Offline Kendall

  • Intergalactic Superstar
  • *****
  • Posts: 137
    • http://www.kendallepark.com
First time with CGI
« Reply #2 on: May 25, 2003, 11:54:25 AM »
ok thanks!!!!

i found this the info but do i put the

#! infront or no?

so is it #!/usr/bin/perl

or

/usr/bin/perl


and how do i upload in ascii?

stephan

  • Guest
First time with CGI
« Reply #3 on: May 25, 2003, 12:07:54 PM »
It is #!/usr/bin/perl

Most ftp software will automatically select ascii for .cgi or .pl files.

Offline Kendall

  • Intergalactic Superstar
  • *****
  • Posts: 137
    • http://www.kendallepark.com
First time with CGI
« Reply #4 on: May 25, 2003, 02:13:16 PM »
ok i got all that but....

when i read how to get to it

Quote
RandomQuote 1.0 Installation & Usage

--------------------------------------------------------------------------------
RandomQuote 1.0 is copyrighted (c) 2001 by DirectCGI. This script is free to use and modify for non-commercial purposes. Permission must be acquired for commercial use of this script. Use this script at your own risk. DirectCGI can not be held responsible for any damages that might arise from use of this script. This script comes with no warranty whatsoever.
--------------------------------------------------------------------------------
1. Unzip the zip archive to an empty directory.
2. Open the "quote.cgi" file and change the first line to wherever perl is located (e.g. "#!/usr/bin/perl").
3. Open the "quotes.dat" file and enter in all desired quotes. These may include HTML.
3. Change the following variable in the script as desired.

$quotes_file = "quotes.dat";
   This is the location of the file in which all of the quotes will be stored.

4. Upload the files to your server as ASCII and CHMOD them to "755".
5. To execute the script, you must use an SSI call such as <~!--#exec cgi="/absolute/path/to/quote.cgi"--> (remove the "~").



i put that in my html and it just shows up as that i put....... how can i make put it in ssi or what ever *sigh*

Offline Kendall

  • Intergalactic Superstar
  • *****
  • Posts: 137
    • http://www.kendallepark.com
First time with CGI
« Reply #5 on: May 25, 2003, 02:22:48 PM »
well i put the tag in my html program frontpage and dreamwaver....


www.kendallepark.com/test2.htm

and nothing blank page :(

*EDIT*

i also cant get my banner that comes with lunar to work so i must be doing something wrong.

Offline snickn

  • Jabba the Hutt
  • *****
  • Posts: 543
    • http://www.snickn.com
First time with CGI
« Reply #6 on: May 25, 2003, 02:34:45 PM »
<!--#exec cgi="/absolute/path/to/quote.cgi"-->

</head>

<body>

<!--#exec cgi="/usr/bin/perl/quote.cgi"--> </body>

<!--#exec cgi="/absolute/path/to/quote.cgi"-->

The above lines should read something more like :

<!--#exec cgi="/home/username/public_html/cgi-bin/quote.cgi"-->

</head>

<body>

<!--#exec cgi="/home/username/public_html/cgi-bin/quote.cgi"--> </body>

<!--#exec cgi="/home/username/public_html/cgi-bin/quote.cgi"-->

Or pretty close to this, I'm not particurly sure why this script would require 3 exec's for it, however the paths should definately be changed :)

cheers.

Offline Kendall

  • Intergalactic Superstar
  • *****
  • Posts: 137
    • http://www.kendallepark.com
First time with CGI
« Reply #7 on: May 25, 2003, 02:36:41 PM »
i just put all those in there to see if it would work in the header or something.........

Offline snickn

  • Jabba the Hutt
  • *****
  • Posts: 543
    • http://www.snickn.com
First time with CGI
« Reply #8 on: May 25, 2003, 02:44:21 PM »
ahhhh..makes sense, your path should definately be home/your_username/public_html/cgi-bin/name_of_script.cgi, and shoudl only be used once :)

/usr/bin/perl is the path to the actual perl application, however, the path to your specific script is different, #!/user/bin/perl should still be the very first line in your script though, this tells where it is.

cheers.

Offline Kendall

  • Intergalactic Superstar
  • *****
  • Posts: 137
    • http://www.kendallepark.com
First time with CGI
« Reply #9 on: May 25, 2003, 02:45:02 PM »
wait......


what!

sorry im a noob  :(

Offline Kendall

  • Intergalactic Superstar
  • *****
  • Posts: 137
    • http://www.kendallepark.com
First time with CGI
« Reply #10 on: May 25, 2003, 02:46:27 PM »
whats the user name?

AHHHHHHHHHHHHHHHHHHHh

Offline snickn

  • Jabba the Hutt
  • *****
  • Posts: 543
    • http://www.snickn.com
First time with CGI
« Reply #11 on: May 25, 2003, 02:46:58 PM »
In the actual website, it should probably be like:

<!--#exec cgi="/home/your_username/www/cgi-bin/quote.cgi"-->

</head>

<body>

<!--#exec cgi="/home/your_username/www/cgi-bin/quote.cgi"--> </body>

In the quote.cgi, the first line should be like :

#!/usr/bin/perl

Note, www is a symbolic link to public_html, therefore either will work, www is just shorter :)

Offline Kendall

  • Intergalactic Superstar
  • *****
  • Posts: 137
    • http://www.kendallepark.com
First time with CGI
« Reply #12 on: May 25, 2003, 02:49:01 PM »
ok then what should i put for user name and home whats home?

im sorry im this is my first time with all this :(

Offline snickn

  • Jabba the Hutt
  • *****
  • Posts: 543
    • http://www.snickn.com
First time with CGI
« Reply #13 on: May 25, 2003, 02:53:47 PM »
your username will be whatever you login to CPanel with, mine for instance is snickn2, since my domain is snickn.com.

home is just the partition on their hard drive, the only thign you will change is your username let's say your username was kendall2, you'd use :

/home/kendall2/www/cgi-bin/quote.cgi

/home/ is a paritition on the hard drive, kendall2 is your "home" directory, since everything you do is based out of that.

hope this helps.

Offline Kendall

  • Intergalactic Superstar
  • *****
  • Posts: 137
    • http://www.kendallepark.com
First time with CGI
« Reply #14 on: May 25, 2003, 03:00:56 PM »
ok should i put this in the header or the body?