|
Author |
Message |
domuk
WebHelper
Joined: 15 Jan 2004
Posts: 91
|
Posted:
Thu Jan 29, 2004 6:27 pm (20 years, 4 months ago) |
|
Hi all,
I this the simplest CGI program that can be written?
I placed it in the cgi-bin, checked the file permissions and tried various combinations on the file and folder
Folder (755)(775)(750)
File (755)(775)(750)
________file: hello.cgi___(upload in ASCII using smarrtFTP)___________
Code: | #!/usr/bin/perl
print "Content-type: text/html\n\n" ;
# Print the HTML response page to STDOUT
print <<EOF ;
<html>
<head><title>CGI Results</title></head>
<body>
<h1>Hello, world.</h1>
</body>
</html>
EOF
exit ; |
(file from http://www.jmarshall.com/easy/cgi/cgi_footnotes.html#samples)
I then called the file from within a html document on my desktop
various ways:
Code: | <a href="http://www.websiteaddress.co.uk/myftpusername/cgi-bin/hello.cgi">my link </a> | <a href="http://www.websiteaddress.co.uk/cgi-bin/hello.cgi">my link </a>
I also changed the file to hello.pl and tried the following link:
Code: | <a href="http://www.websiteaddress.co.uk/cgi-bin/hello.pl">my link </a> |
I then tried a simple text file with a few words in it:
Code: | <a href="http://www.websiteaddress.co.uk/cgi-bin/hello.txt">my link </a> |
I have looked at other sites hosted by www.easily.co.uk to try and look at how they have called a cgi program, here is an example:
Code: | <A HREF="http://www.z2group.co.uk/binbghwp0akf/cgi-bin/message/ubbmisc.cgi?action=setprefs"> other easly link
</a> |
Nothing has worked and I am getting very frustrated. I have bin through numerous tutorials on CGI and file permissions and think I understand how to change them.
I am using smart FTP and for a file right click on the file, select CHMOD and type the number in then close it down. When you next open the program it appears to have worked changed.
To change a folder I have been typing “site chmod 755 /cgi-bin/” and the on screen appears to be working. then I close it down and when I next enter it appears to have changed.
Don’t know how to access the servers error log, any ideas?
Where and how do you enter this code to check for errors "perl -cw myscript.cgi".
How do I find the perl interpreter with the Unix command "which perl" in smartFTP?
I have tried both of these paths to perl:
Code: | #!/usr/local/bin/perl
#!/usr/bin/perl |
I am on phobos server. Are the settings for this server standard throughout the web or will they be specific to easily?
The technical help keeps coming back with “we do not offer coding support”. They originally gave me duff path information when I was setting up .htaccess files. I suspect that it I am missing some vital server / configuration / path information. I just do not know what else to try.
Have I missed anything?
I can not help thinking that it took me 10 min to get the .htaccess files working when they eventually gave me the correct information. Prier to this I had been struggling for days.
Please Please help,
Thank you again,
Dom. |
|
|
|
|
SfCommand
Senior WebHelper
Joined: 10 Nov 2002
Posts: 143
Location: UK
|
Posted:
Thu Jan 29, 2004 10:27 pm (20 years, 4 months ago) |
|
|
|
|
domuk
WebHelper
Joined: 15 Jan 2004
Posts: 91
|
Posted:
Thu Jan 29, 2004 10:53 pm (20 years, 4 months ago) |
|
#!/usr/bin/perl -w
Is this what you mean? |
|
|
|
|
domuk
WebHelper
Joined: 15 Jan 2004
Posts: 91
|
Posted:
Fri Jan 30, 2004 10:15 am (20 years, 4 months ago) |
|
Horray, I got it working!!!
I would just like to thank everyone that helped,
I Deleted everything in my cgi bin and double checked everything and it worked.
I tried calling it from my browser like this:
Code: | <br>
<a href="http://www.mydomaine.co.uk/cgi-bin/test3.cgi">test3.cgi
</a> |
and this:
Code: | <br>
<a href="http://www.mydomaine.co.uk/cgi-bin/tester.pl">test3.pl
</a> |
and it worked!!!
1) When I call the .cgi my browser asks me to save or open it, how can I just open it without this message?
Thanks again,
Dom..
Ps I found this site good http://perl.about.com/library/weekly/aa010902d.htm |
|
|
|
|
Daniel
Team Member
Joined: 06 Jan 2002
Posts: 2564
|
Posted:
Fri Jan 30, 2004 2:04 pm (20 years, 4 months ago) |
|
When you open the .cgi file, are you sure the Perl script has been processed (do you see HTML or Perl code when you open it). It sounds to me like the server is not interpreting the code if the browser is prompting you to open or save the file. |
________________________________
|
|
|
|
|
|
You cannot post new topics in this forum. You cannot reply to topics in this forum. You cannot edit your posts in this forum. You cannot delete your posts in this forum. You cannot vote in polls in this forum.
|
Page generation time: 0.126295 seconds :: 18 queries executed :: All Times are GMT
Powered by phpBB 2.0
© 2001, 2002 phpBB Group :: Based on an FI Theme
| |