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))

Posted by SonnyZA (SonnyZA), 19 December 2004
Hello ppl,  

I just joined and hope that someone can help me with this problem (and lots of others in the future)

I recently d/l a Perl script from (guestbook) It looks like a really good perl. I always used free web hosting and their guestbooks. So I never had to learn anything about .cgi or .pl. Now I am still with a free web hosting, but a very good one with .cgi, ftp etc.

Now my problem, I just can't get the .pl file to work. I know I am making mistakes somwhere, but where? According to this script, i must configure my .pl script as follows.

$guestbookurl = "";
$guestbookreal = "/home/yourname/public_html/guestbook.html";
$guestlog = "/home/yourname/public_html/guestlog.html";
$cgiurl = "";
$date_command = "/usr/bin/date";

(English not my home language   )

So I set it like this:

$guestbookurl = "";
$guestbookreal = "/www/";
$guestlog = "/www/";
$cgiurl = "";
$date_command = "/usr/bin/date";

My webpage I am trying to set up is So does it look right? The error I get is the classic "500 internal server error"

Here is the error I receive from my logs in my members control members:

Premature end of script headers: /home/users/getaweb/www/
sh: line 1: /usr/bin/date: No such file or directory
sh: line 1: /usr/bin/date: No such file or directory
Can't Open www/ No such file or directory

I tried all I know. Please help.

greetings from South-Africa

PS: If I broke any rules (like too long post, please forgive me   )

Posted by Custard (Custard), 19 December 2004

You need to find your 'date' program.

You also need to know what OS your site is hosted on.

If there is no date program, then you may need to edit the script to get the date some other way.
The 'Perl' way to get dates is using  gmtime( time ), so it seems that the script is a bit odd using a separate OS specific date program anyway.



Posted by admin (Graham Ellis), 19 December 2004
Hi, Welcome Sonny.  Your post is fine.  Good to see the error log which gives me the clues as to what the (current) problems are ....

Firstly, your ISP doesn't have a date command that's available for you to use under /usr/bin/date by the look of things. It might work if you use /bin/date, or failing that you may need to ask your ISP.

The second problem shown is that you have some of the paths to various files set incorrectly.  I would not expect public_html to appear in any URLs (so the setting for $guestbookurl is probably wrong), and I think that $guestbookreal should be something like /home/users/getaweb/www/ (and $guestlog should be something similar).

Changes of me having made the right "educated guess" in each case is slim, but you can experiment around and see how your error messages change / eventually go away.

Problems like these feel like they're going to be hard to fix and you keep experimenting for hours then, suddenly, everything falls into place ... I'm sure you'll get there


Edit to add [Bruce - sorry for the "overpost" ... I started writing before you finished.  Perhaps we need a thread locking system ]

Posted by SonnyZA (SonnyZA), 19 December 2004

Firstly thank you for replying.
My host is running a unix server. This is something they said about perl paths:

Yes, you are allowed to use .cgi and .pl files in your account.
The Perl scripts do not require a special /cgi-bin/ directory. You can place Perl and PHP scripts into any directory you wish.

The path to the Perl directory is /usr/bin/perl

I just know very little about this path. Must I create this in my folder? Or is it there already? The public_html i created myself in my account...i guess it was wrong. Its because the .pl script ask for such a directory for installation.

I wil try the rest of your advise and play with the paths...I believe its wrong aswell.
This date program, is it server side? Or must I create this, if so, how? My host support a lot (most) settings, I think it's me that have it wrong.

I am really a newbie, but I believe I learn and do not forget.



Posted by admin (Graham Ellis), 19 December 2004
There are so many different ways of setting up hosting ... if you can tell me who your service provider is (for example a link to their support pages or FAQ) I can have a look and give some further thoughts on these settings.

The good news is your script is basically running - otherwise your error log would be different - so it's just the settings that are needed to be corrected

Posted by SonnyZA (SonnyZA), 19 December 2004

First good news I received in days. I will really appreciatte this.

After I signed up, my adress was

When in my users directory, the path to my uploaded files are this:
(hope this help)

In the meantime I am still trying.  



Posted by admin (Graham Ellis), 19 December 2004
OK .. the FAQ doesn't tell me very much!

Go in with your FTP client and run a "pwd" command in it. That will tell you your root directory.   Use that directory name followed by /guestbook.html as the setting for the variable $guestbookreal.  $guestlog should be the same thing with /guestlog.html instead. If this doesn't work, then the FTP client may have a "false root" and you may need to add an extra path such as /home/user/getaweb/ on the begining.

$guestbookurl should be set to "http://(your hostname)/ guestbook.html

With the date ... have you tried /bin/date yet?? Did it (at least) clear the date error message??

Posted by SonnyZA (SonnyZA), 19 December 2004

Some interesting things happened. firstly, I did change the /bin/date and now that error is gone. woohoo.  

I did a pwd in ftp and it seems is my path. It gave this aswell:  Response:      257 "/" is current directory.
Then I tried a few different settings. Firstly I tried this:

$guestbookurl = "";
$guestbookreal = "/home/users/getaweb/www/";
$guestlog = "/home/users/getaweb/www/";
$cgiurl = "";
$date_command = "/bin/date";

and I got this errors:

[Mon Dec 20 00:43:25 2004] [error] [client] Premature end of script headers: /home/users/getaweb/www/
Can't Open /home/users/getaweb/www/ No such file or directory
[Mon Dec 20 00:43:36 2004] [error] [client] Premature end of script headers: /home/users/getaweb/www/

then I tried this: (see I left out: /home/users/getaweb/www/)

$guestbookurl = "";
$guestbookreal = "/";
$guestlog = "/";
$cgiurl = "";
$date_command = "/bin/date";

and got this slightly different errors.

[Mon Dec 20 00:46:30 2004] [error] [client] Premature end of script headers: /home/users/getaweb/www/
Can't Open / No such file or directory
[Mon Dec 20 00:46:35 2004] [error] [client] Premature end of script headers: /home/users/getaweb/www/

Still gave me  "/home/users/getaweb/www/" error.  

I got a "addguest.html" and according to the script writer, it must direct it to "" I put it now in " because my host says it doesn't matter where I put it (execgi or something?) I myself created the cgi-bin directory. I even tried to rename it to guestbook.cgi. Heard somewhere it could help.

so sorry to bother you with my newbie knowledge. But after this, I'll never forget this problem!



Posted by admin (Graham Ellis), 20 December 2004
The cgi-bin directory and your current placement of the script is CORRECT - otherwise, you wouldn't be able to get at the script to run it at all.  You have almost everything else right too.  The name of this file appears at the top of the error message because the error occurs while this file is being run. Do NOT move it!

The problem is that there are in effect TWO absolute paths to a file on a web server.   The first is the path to the file as it's known to the operting system, and the second is the path as it's known to the web.  For example, on our secondary site the file
is known by the URL

What you need to establish is the Operating System paths to your guestbook and log files and put those into the assignments to $guestbookreal and $guestlog.   The slight change of error messages that you're seeing reflects slightly different failing experiments.   When you hit it right, the current problem will be fixed (There *may* be another problem beyond).  

The FAQ gave no clue as to what the path should be in your particular ISP's case.  I think the information is probably available to you in the members are which (of course) I cannot reach; have a look there, or use their contact form to ask.  Anyone without an account there (and that, to my knowledge, includes all opentalk posters except yourself) can only guess.

Good luck - let us know how you get on.

Posted by SonnyZA (SonnyZA), 20 December 2004
Hello !

The master, Graham Ellis
has spoken! No one could help me, but you did.

We got it right, it's working!!
You see, my host put this infront of my path in error log:

And I changed it after I took your advice, to only.

like this:
$guestbookurl = "";
$guestbookreal = "/home/www/";
$guestlog = "/home/www/";
$cgiurl = "";
$date_command = "/bin/date";

and violla!

I now know that the important thing is to surely get the right path and not to speculate!
I humblely thank you again and I will bother you again with other problems, seeing that I want to learn Perl and later on Phyton.

Thanking you


PS: You have really no idea how much this meant for me  

Posted by admin (Graham Ellis), 20 December 2004
I'm ... lost for words.  It was my pleasure to assist

- Graham

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.

4 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