Printer Friendly Version Print this thread
Email this thread to a friend eMail this thread to a friend
Featured Web Site Template

Hundreds More at Free Site Templates.com!

Web Site Partners
Sponsored Links
Jet City Software
 
Whos Here ?
There are 0 guests and 1 members in the forums right now.
Reflects user activity within the last 5 minutes
Moderator(s): Prowler, jcokos
Member Message

rowanp
Joined: Apr 09, 2004
# Posts: 19

View the profile for rowanp Send rowanp a private message

Posted: 2005-Apr-13 13:01
Edit Message Delete Message Reply to this message

Hi

When I get a page to return variables to a cgi script, my browser opens the cgi as a download file, instead of loading it as a webpage. How can I fix this?

Regards

rowanp.



lizardz
Joined: Nov 12, 2004
# Posts: 1394

View the profile for lizardz Send lizardz a private message

Posted: 2005-Apr-13 20:08
Edit Message Delete Message Reply to this message

Is this on your own computer or on the webserver? I assume you're using a form to send some values to the cgi script? What script is it, is it a perl thing?

Perl scripts need some values added to make them run as perl scripts, the path to perl for example needs to be correct, that's on the first line of the script usually, like this:

#!/bin/perl5

or something like that.

If you're running this on your own box, of course you'll need a webserver and perl modules installed.

[ Message was edited by: lizardz 04/13/2005 12:46 pm ]





rowanp
Joined: Apr 09, 2004
# Posts: 19

View the profile for rowanp Send rowanp a private message

Posted: 2005-Apr-13 20:59
Edit Message Delete Message Reply to this message

It is on a server. You may be right about the path to perl. It may not be on the particular cgi file that I am working with.



lizardz
Joined: Nov 12, 2004
# Posts: 1394

View the profile for lizardz Send lizardz a private message

Posted: 2005-Apr-13 22:15
Edit Message Delete Message Reply to this message

Usually you can get the path to perl from the hoster on their site, assuming you have a hoster, or from tech support.

If not, you can login with telnet or ssh, then just query the server directly for the perl path, like:

which perl
which perl5
whereis perl

or something like that, that should give you the path.



Prowler
Staff
Joined: Aug 14, 2000
# Posts: 1788

View the profile for Prowler Send Prowler a private message

Posted: 2005-Apr-14 08:58
Edit Message Delete Message Reply to this message

Your server will have been configured to run or execute files found only under some specific directory - usually cgi-bin. This directory will have specific permissions set to execute the files - whether they have the extension of cgi,pl, or whatever.

Only in that directory, the server will look at the shebang - the top line which defines which binary to use for the execution of the script.
For perl scripts, the shebang will be :
#!/usr/bin/perl
Your server may have been configured differently though.

In case if the path to the Perl binary is wrong, it will return the much dreaded Internal Server Error 500. It won't send the file as a text file to you through the browser.

So I suggest that you look for the directory - cgi-bin and dump your script there.



rowanp
Joined: Apr 09, 2004
# Posts: 19

View the profile for rowanp Send rowanp a private message

Posted: 2005-Apr-14 09:02
Edit Message Delete Message Reply to this message

I think that I have solved the problem. It was not the path to perl but the "Content text/html..." that was not being sent to the server.

Thanks for all your help.


You are not permitted to post messages in this forum or topic, because of one or more of the following reasons:
  1. You have not yet logged in, or registered properly as a member
  2. You are a member, but no longer have posting rights.
  3. This is a private forum, for which you do not have permissions.

If you are a recent member, it's possible that you simply have not yet confirmed your account. Please check your email for a message entitled 'JimWorld Forums: Confirm Your Account' and follow the instructions contained within.

If you cannot find this message, click here to Re-Send it.

If you are still experiencing problem, please read the Login Assistance Article for some advice on what may be causing your login not to work properly.

Switch to Advanced Editor and ... Create a New Topic or Reply to this Thread

New posts Forum is locked
© 1995  ·  iWeb, Inc  ·  DBA JimWorld Productions