Training, Open Source computer languages
PerlPHPPythonMySQLApache / TomcatTclRubyJavaC and C++LinuxCSS 
Search for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
For 2023 (and 2024 ...) - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))
Perl and Guestbook

Posted by morch76 (morch76), 25 September 2005
Hi!  I am totally clueless when it comes to perl and guestbook.  I downloaded a perl from  I keep getting the following error: Premature end of script headers:  I contacted my hosting company ( 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 = "";
$guestbookreal = "httpdocs/guestbook.htm";
$guestlog = "httpdocs/guestlog.htm";
$cgiurl = "";
$date_command = "/usr/bin/date";

Posted by admin (Graham Ellis), 25 September 2005
The error is probably not in the code snippet that you quoted.

Any CGI script generates

a) a header  e.g.
content-type: text/html
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 2005
Err .... 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 2005
HI - thanks! Got it working - thanks!

Posted by admin (Graham Ellis), 25 September 2005
What 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 2005
It 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!

This page is a thread posted to the opentalk forum at and archived here for reference. To jump to the archive index please follow this link.

3 unpublished comments pending on this page

edit your own (not yet published) comments

© WELL HOUSE CONSULTANTS LTD., 2024: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: • WEB: • SKYPE: wellho