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))
Guestbook.pl

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 http://www.scriptarchive.com (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 = "http://your.host.com/~yourname/guestbook.html";
$guestbookreal = "/home/yourname/public_html/guestbook.html";
$guestlog = "/home/yourname/public_html/guestlog.html";
$cgiurl = "http://your.host.com/cgi-bin/guestbook.pl";
$date_command = "/usr/bin/date";

(English not my home language   )

So I set it like this:

$guestbookurl = "http://getaweb.za.net/public_html/guestbook.html";
$guestbookreal = "/www/getaweb.za.net/public_html/guestbook.html";
$guestlog = "/www/getaweb.za.net/public_html/guestlog.html";
$cgiurl = "http://getaweb.za.net/cgi-bin/guestbook.pl";
$date_command = "/usr/bin/date";

My webpage I am trying to set up is http://getaweb.za.net 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/getaweb.za.net/cgi-bin/guestbook.pl
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/getaweb.za.net/public_html/guestbook.html: No such file or directory

I tried all I know. Please help.

SonnyZA
greetings from South-Africa

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

Posted by Custard (Custard), 19 December 2004
Hi,

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.

HTH

Bruce

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/getaweb.za.net/public_html/guestbook.html (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

Graham

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
Hello  

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.



Greetings

SonnyZA


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
Hello  

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

http://www.100webspace.com/freeplan.html
http://www.100webspace.com/faq.html

After I signed up, my adress was http://getaweb.freeprohost.com

When in my users directory, the path to my uploaded files are this:
www/getaweb.za.net/all-other-files
(hope this help)

In the meantime I am still trying.  

Greetings

SonnyZA




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
Hello  

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 getaweb.za.net is my path. It gave this aswell:  Response:      257 "/" is current directory.
Then I tried a few different settings. Firstly I tried this:

$guestbookurl = "http://getaweb.za.net/guestbook.html";
$guestbookreal = "/home/users/getaweb/www/getaweb.za.net/guestbook.html";
$guestlog = "/home/users/getaweb/www/getaweb.za.net/guestlog.html";
$cgiurl = "http://getaweb.za.net/guestbook.pl";
$date_command = "/bin/date";

and I got this errors:

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

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

$guestbookurl = "http://getaweb.za.net/guestbook.html";
$guestbookreal = "/getaweb.za.net/guestbook.html";
$guestlog = "/getaweb.za.net/guestlog.html";
$cgiurl = "http://getaweb.za.net/guestbook.pl";
$date_command = "/bin/date";

and got this slightly different errors.

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

Still gave me  "/home/users/getaweb/www/getaweb.za.net/guestbook.pl" error.  

I got a "addguest.html" and according to the script writer, it must direct it to "http://getaweb.za.net/cgi-bin/guestbook.pl" I put it now in "http://getaweb.za.net/guestbook.pl 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!

Greetings

Sonny


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
    /home/wellcouk/public_html/demo/abc.html
is known by the URL
    http://www.wellho.co.uk/demo/abc.html

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:

/home/users/getaweb/www/
And I changed it after I took your advice, to only.
/home/www/

like this:
$guestbookurl = "http://getaweb.za.net/guestbook.html";
$guestbookreal = "/home/www/getaweb.za.net/guestbook.html";
$guestlog = "/home/www/getaweb.za.net/guestlog.html";
$cgiurl = "http://getaweb.za.net/cgi-bin/guestbook.pl";
$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

SonnyZA

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 www.opentalk.org.uk 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: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho