Perl and Guestbook
Posted by morch76 (morch76), 25 September 2005Hi! I am totally clueless when it comes to perl and guestbook. I downloaded a perl from http://www.scriptarchive.com. I keep getting the following error: Premature end of script headers: guestbook.pl. I contacted my hosting company (www.apollohosting.com) and even they can't help me! Please someone help me!!!
Here is the part of the code (it was too long for me to put it all in:
$guestbookurl = "http://www.prattfiredept.com/guestbook.htm";
$guestbookreal = "httpdocs/guestbook.htm";
$guestlog = "httpdocs/guestlog.htm";
$cgiurl = "http://www.prattfiredept.com/cgi-bin/guestbook.pl";
$date_command = "/usr/bin/date";
Posted by admin (Graham Ellis), 25 September 2005The error is probably not in the code snippet that you quoted.
Any CGI script generates
a) a header e.g.
b) a blank line (to show that the header has been sent)
c) page content
It's probable (judging by the error message) that your script isn't sending out the content-type header; perhaps it's generating an error message instead, or the blank line is missing.
As you've probably not modified Matt's error message very much, I would take an educated guess that there's some sort of error message being generated which the CGI handler isn't understanding. Perhaps your ISP has Perl in a different location to where the script expects it, or perhaps some of your file permissions are wrong.
You may have done this already ... but I would start by checking all the tips given in the FAQ on the site that you downloaded the script from and ensure that all you file permissions, etc, are correct. I would then check with the FAQ at the ISP that should tell you how to run CGI scripts on their server. You may be advised to change (for example) the #! line at the top of the script.
Next step ... run the script directly in an ssh (or telnet) session and see what output it actualy generates; that should give far better clues that that "masked" premature end of script headers message! If you get to this point and want some further help in interpretting the ouput, please post the output you get as a follow up here.
Posted by admin (Graham Ellis), 25 September 2005Err .... as a follow up, I clicked on one of the URLs in your original message and found that the script appears to be working correctly; perhaps I have been spinning my wheels to correct a problem that no longer exists??
If a problem does still exist, please let us know the URL so that we can see it.
If a problem no longer exists, please confirm.
Please note that if you ask for help but then solve your own problem, it's polite to let people know. It saves them wasting a lot of time and feeling pretty pissed off that they've been "used"
Posted by morch76 (morch76), 25 September 2005HI - thanks! Got it working - thanks!
Posted by admin (Graham Ellis), 25 September 2005What did the problem turn out to be? If you fill us in, you may save some other poor soul the same heartache in the future ...
Posted by morch76 (morch76), 25 September 2005It turned out my hosting company was clueless! They did not give me the correct path. I kind of had to figure it out on my own.
I still don't have the date thing set up, so I have to figure that one out!
edit your own (not yet published) comments
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: firstname.lastname@example.org • WEB: http://www.wellho.net • SKYPE: wellho