Lunarpages Web Hosting Forum

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

Offline snickn

  • Jabba the Hutt
  • *****
  • Posts: 543
    • http://www.snickn.com
First time with CGI
« Reply #15 on: May 25, 2003, 03:08:20 PM »
I don't believe it matters, I would put it in the body.

cheers.

Offline Kendall

  • Intergalactic Superstar
  • *****
  • Posts: 137
    • http://www.kendallepark.com
First time with CGI
« Reply #16 on: May 25, 2003, 03:09:32 PM »
<!--#exec cgi="/home/kendal2/www/cgi-bin/quote.cgi"-->

i put that in the body thats it!

www.kendallepark.com/test4.htm

and nothing.............

Offline snickn

  • Jabba the Hutt
  • *****
  • Posts: 543
    • http://www.snickn.com
First time with CGI
« Reply #17 on: May 25, 2003, 03:19:24 PM »
mmm....You may have to wait for stephan or kelvin or one of them to come around, I'm not overly familar with CGI, so I can only provide you with the basics. I'm sorry.
 
There's some folks on here (twebman? stephan? etc. etc.) who are great with this though, and they will follow up where i failed :P

cheers.

Offline Kendall

  • Intergalactic Superstar
  • *****
  • Posts: 137
    • http://www.kendallepark.com
First time with CGI
« Reply #18 on: May 25, 2003, 03:25:28 PM »
youve been great!!! maybe the scripts is broken or somethin :(


but with anyother cgi scripts i know what to do :)

Offline snickn

  • Jabba the Hutt
  • *****
  • Posts: 543
    • http://www.snickn.com
First time with CGI
« Reply #19 on: May 25, 2003, 03:26:19 PM »
hehe. blame it on the script..that always works, what's the chance that that script's author would read this to defend himself ;)

Offline Ed

  • Berserker Poster
  • *****
  • Posts: 5156
    • Joke A Whenever
First time with CGI
« Reply #20 on: May 25, 2003, 05:53:45 PM »
It should go in the body of the page.

If that code does not work (I doubt it will). You need to use nonabsolute referencing for any SSI. It does not use the server path, it uses the same path as the visitor to your site uses.

So it should be:

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

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

Hope that helps!

- Ed :-)

Offline Ed

  • Berserker Poster
  • *****
  • Posts: 5156
    • Joke A Whenever
First time with CGI
« Reply #21 on: May 25, 2003, 05:58:39 PM »
eek.. just noticed another problem why:

www.kendallepark.com/test4.htm

wont work :-) You need to enable SSI parsing for .htm and .html files before it will show the results of any SSI commands. (do a search on the forum, and you should see lots of posts on it! I wrote up a tutorial on it a while back.. if I can only find it....).

But... if you don't want to do that right away, and just want to test you script.

put that same code into a file called:
www.kendallepark.com/test4.shtml

thats .shtml instead of .htm or .html

- Ed :-)

Offline Kendall

  • Intergalactic Superstar
  • *****
  • Posts: 137
    • http://www.kendallepark.com
First time with CGI
« Reply #22 on: May 25, 2003, 07:20:02 PM »
hmmmm its closer but still no luck!

http://www.kendallepark.com/test4.shtml

says i got a error

Offline snickn

  • Jabba the Hutt
  • *****
  • Posts: 543
    • http://www.snickn.com
First time with CGI
« Reply #23 on: May 25, 2003, 07:38:31 PM »
paste what you have in the page, we can't see it now :)

Offline Ed

  • Berserker Poster
  • *****
  • Posts: 5156
    • Joke A Whenever
First time with CGI
« Reply #24 on: May 25, 2003, 07:44:57 PM »
ok, one more correction.
It looks like your are parsing the SSI correctly, its just the path that is causing the problem.

Try removing the initial / from the directory.
<!--#exec cgi="cgi-bin/quote.cgi"-->

Also,

Try running the actual program as well, and seeing what it outputs!
http://www.yourdomain.com/cgi-bin/quote.cgi

- Ed :-)

Offline snickn

  • Jabba the Hutt
  • *****
  • Posts: 543
    • http://www.snickn.com
First time with CGI
« Reply #25 on: May 25, 2003, 07:46:42 PM »
It wanted absolute path though Kata, which would be /home/kendal2/www/cgi-bin/quote.cgi

but Kendall, I think what you need to do is go into either cpanel or ftp and set file permissions for that file to 755, that should fix it I believe :)

cheers.

Offline Ed

  • Berserker Poster
  • *****
  • Posts: 5156
    • Joke A Whenever
First time with CGI
« Reply #26 on: May 25, 2003, 07:51:47 PM »
Give me a shout if you are able to get absolute path to work for and SSI directive. I have yet to be able to get it to work. SSI should be running in a secure mode, and not in open access to all files, thus it only can access what the user has access to (and thus not the servers directories) only the apparent directories in the public_html.

You are correct about the permissions though! Try 755 first, and if that does work, try 777.

Though the problem is still with the SSI. When that is fixed, you should see a 500 error on the page instead. (Unless you have fixed the permissions).

- Ed :-)

Offline snickn

  • Jabba the Hutt
  • *****
  • Posts: 543
    • http://www.snickn.com
First time with CGI
« Reply #27 on: May 25, 2003, 07:52:45 PM »
mmm...I see...so that may be the issue with SSI and absolute paths, I just know her script asked for the absolute, although in realty, cgi-bin/blah should work too

cheers.

Offline Ed

  • Berserker Poster
  • *****
  • Posts: 5156
    • Joke A Whenever
First time with CGI
« Reply #28 on: May 25, 2003, 07:55:49 PM »
Ya. SSI shouldn't be able to access the absolute path because then you could have a malicious person request a printout of your .htaccess or  username.pass or somethign great like that.

I had that problem when I first moved to lunarpages, and i finally figured out that it was just the wrong path name.

When the SSI is workign correctly and the script is not, you will get whatever the output was, and in this case it would be a 500 error. The  "Error processing directive" is a failure in the SSI to execute the command.

Its kinda annoyying cause sometiems you need to nest ../ to go back a directory or two at times.

- Ed :-)

Offline Kendall

  • Intergalactic Superstar
  • *****
  • Posts: 137
    • http://www.kendallepark.com
First time with CGI
« Reply #29 on: May 25, 2003, 08:54:45 PM »
<html>

<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>

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

</html>


thats all the html on the test4 page.


*edit*

just did all the 755 stuff and nothing tryed 755 and 777 and nothing tryed it will all the fodlers involved nothing *sigh*