PDA

View Full Version : Trouble implementing Matt's "Guestbook" pl script


bc_comm
03-18-2005, 08:58 PM
I am new to CGI programming, although have some programming experience. I am trying to implement Matt's Script Archive Guestbook script which provides users with a form to complete, runs the script and posts their information.

In testing now, I see the following error after the form is submitted:

CGI Error
The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are:

The system cannot find the path specified.
The system cannot find the path specified.
Can't Open d:inetpubwwwrootjewishchildcareny.orglumni est120l_guestbook_test.asp: Invalid argument

The modified section of the script currently reads as follows:

$guestbookurl = "http://www.jewishchildcareny.org/alumni/test120/al_guestbook_test.asp";

$guestbookreal = "d:\inetpub\wwwroot\jewishchildcareny.org\alumni\test120\al_guestbook_test.asp";

$guestlog = "d:\inetpub\wwwroot\jewishchildcareny.org\alumni\test120\guestlog.html";

$cgiurl = "http://www.jewishchildcareny.org/cgi-bin/guestbook_alumni.pl";

$date_command = "/usr/bin/date";

I'm quite sure that the paths are listed incorrectly, but Matt instructs me to use the variables as follows:
$guestbookurl: url address of the guestbook file

$guestbookreal: system locatino of the guestbook file (my web host said my system location was d:\inetpub\wwwroot\jewishchildcareny.org\

$guestlog: system location of guestlog file

$cgiurl: the url portion of the address to the script file

Does anyone have any insight on why I may be getting this error? Is this a permissions problem? I uploaded the script in Dreamweaver.

Thanks very much for your thoughts.

mlseim
03-19-2005, 12:15 AM
Are you using a remote webhost ... like one you access
on the internet, or a local host ... like you have your
own local server?

WW.
03-19-2005, 03:53 PM
I'm no expert, but the error message makes it look the backslashes in the strings are being treated as special characters (e.g. \t is a tab). Try doubling all the backslashes. For example,
$guestbookreal = "d:\\inetpub\\wwwroot\\jewishchildcareny.org\\alumni\\test120\\al_guestbook_test.asp";

andyede
03-20-2005, 12:25 PM
could be the above. you can get away without using double backslashes by just ising single quotes ' instead of double ones " . that way perl won't try and look for special chars.

you have a windows server right? most perl script come set up for a linux servers and have the shebang line (very first one starting with #!) pointing to where perl will be on a linux server, usually #!/usr/bin/perl or similar. On a windows server you need to set it to something like #!C:\perl\bin\perl

bc_comm
03-22-2005, 04:04 PM
Thanks for the responses. I checked with my web host (our site is on a remote server) and they replied (with bad spelling and punctuation!): you are hosted on a windows 2000 platform. you should be able to use relitive paths

ie #/usr/bin/perl

And then I changed to quotes to single quotes as you suggested. The error has changed slightly now. Now, it says:

Can't Open d:\inetpub\wwwroot\jewishchildcareny.org\alumni\test120\al_guestbook_test.asp: Permission denied

So...is this an issue of chmod'ing the file to 755? I tried setting the permissions in Dreamweaver but the server refused it. Perhaps this is something my web host has control of?

mlseim
03-22-2005, 05:10 PM
You might have to get a hold of an FTP program ...
a stand-alone program that can connect you to your
web space files. The FTP program has a method to
assign permissions (CHMOD).

bc_comm
03-30-2005, 05:58 PM
Well, the suggestions you all made helped me get there and then the final issue was that I didn't have write access to the files I was writing to (the guestbook itself and the log too). Once I set up a write permissions folder with my host, things were working again!

Now, I'm working on how the data is outputted into the guestbook. I changed the form a bit and added checkboxes and other text fields. Trying to figure out the script to write to the guestbook if certain checkboxes were selected...