Closed Thread Icon

Topic awaiting preservation: CGI question (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=12006" title="Pages that link to Topic awaiting preservation: CGI question (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: CGI question <span class="small">(Page 1 of 1)</span>\

 
docilebob
Maniac (V) Mad Scientist

From: buttcrack of the midwest
Insane since: Oct 2000

posted posted 01-19-2002 17:37

I`m trying to get a guestbook script to run, and it tells me that it can`t find the guestbook file. It`s looking for the html page, yes ?
The page is located in the public html folder and the name is bg.htm, so the correct unix path is : /public_html/gb.htm right ?



Nearly everyone considers themselves to be good drivers.
98.3% of you are mistaken.

Piper
Paranoid (IV) Inmate

From: California
Insane since: Jun 2000

posted posted 01-19-2002 19:07

Can you post the code or put up a link to the code? Also, what exactly is the message in your error_log? The error message will help the most.

Regards,
Charlie

[edit]
Almost forgot, the path would be something like this: /home/user_name/public_html/file.html
[/edit]

[This message has been edited by Piper (edited 01-19-2002).]

hyperbole
Paranoid (IV) Inmate

From: Madison, Indiana, USA
Insane since: Aug 2000

posted posted 01-19-2002 21:50

Why not just use the relative path "gb.html" or "./gb.html"? either of these should find the file if it is in the same directory with the page that links to it.

docilebob
Maniac (V) Mad Scientist

From: buttcrack of the midwest
Insane since: Oct 2000

posted posted 01-20-2002 01:01

The last entry in the error log is * file permissions deny file execution * permissions on the public folder, the cgi folder, the page, and the script are set to 776. ( owner-R-W-E, group-R-W-E, public- R-W )

the custom error message says *Unable to locate your guestbook file
Please check that /../public_html/gb.htm is the correct path and name * I`ve tried all the permutations of paths that I can think of...The page is in the public_html folder, and the script is in the cgi_bin folder (which is in the public_html folder)

The code is here



[This message has been edited by docilebob (edited 01-20-2002).]

Piper
Paranoid (IV) Inmate

From: California
Insane since: Jun 2000

posted posted 01-20-2002 01:40

Try setting your path to this:

code:
$GUESTBOOK="../gb.htm";


or this

code:
$GUESTBOOK="/home/user_name/public_html/gb.htm";


replacing /home/user_name with the correct, full path to your public_html dir. You might also have a permissions problem. If your server has Apache suExec support, 776 could be a problem. Try setting all executable scripts to 755 if you still have problems after getting the path problem corrected.

Regards,
Charlie

docilebob
Maniac (V) Mad Scientist

From: buttcrack of the midwest
Insane since: Oct 2000

posted posted 01-20-2002 02:06

Ok, I`m not sure where I`m screwing this up, but now, it makes it past the *check for required fields * part, ( although, for a while it said all required fields were not filled ,even though they are ) and I get a 404 error. The address in the browser is the path to the cgi script, and it is correct. The error log shows the path to the html page, but modified.
in the script, the path is : /home/carlasings/public_html/gb.htm

In the error log it shows : File does not exist: /home/carlasings/public_html/public_html/gb.htm ( it has public_html twice )

I must be missing something basic, yes ?

Piper
Paranoid (IV) Inmate

From: California
Insane since: Jun 2000

posted posted 01-20-2002 02:13

I missed this one the first time around:

code:
$GUESTBOOK_URL="http://carlasings.com/public_html/gb.htm";


should be the url, not the path. You got a mixture of both in there Try:

code:
$GUESTBOOK_URL="http://carlasings.com/gb.htm";



If you still get errors, update the zip in the link above so I can look at the current code.

Thanks,
CP

docilebob
Maniac (V) Mad Scientist

From: buttcrack of the midwest
Insane since: Oct 2000

posted posted 01-20-2002 03:00

Cool, Thanks for all your help, Piper. I knew it was something basic.

Everything seems to be working now, except that it doesn`t write back to the guestbook page...Can`t see any reason to prevent it...

Updated code in the zip above.

<edit> the error log is still showing : * File does not exist: /home/carlasings/public_html/public_html/gb.htm *

Two *public_html* the address in the script has only one. Is this why it is not writing to the guestbook page, and why does it add that ?</edit>

[This message has been edited by docilebob (edited 01-20-2002).]

Piper
Paranoid (IV) Inmate

From: California
Insane since: Jun 2000

posted posted 01-20-2002 05:21

Is your error_log giving you any line numbers at all? I went through the code again and I don't see where it could be getting the second 'public_html' from. If there are no line numbers, try adding use CGI::Carp qw/fatalsToBrowser warningsToBrowser/; at the top of the script right underneath your path to perl. That might get you a more detailed error message.

~CP

docilebob
Maniac (V) Mad Scientist

From: buttcrack of the midwest
Insane since: Oct 2000

posted posted 01-20-2002 07:32

I dunno...The error log does not show line numbers, and either I put your suggested code in the wrong place, or it didn`t help.

Now, it shows no new error messages at all, but still doesn`t write back to the page.

Petskull
Maniac (V) Mad Scientist

From: 127 Halcyon Road, Marenia, Atlantis
Insane since: Aug 2000

posted posted 01-20-2002 20:41

I wrestled with bnbbook for a while and it did the same thing (didn't write to the file)

...so I finally gave up and started to design my own... didn't finish it though...


"...when I'm high like heaven, when I'm strong like music, 'cause I'm slow like honey and heavy with mood..."
ICQ: 67751342


[This message has been edited by Petskull (edited 01-20-2002).]

docilebob
Maniac (V) Mad Scientist

From: buttcrack of the midwest
Insane since: Oct 2000

posted posted 01-23-2002 03:42

No new ideas, anybody? ( thanks again, piper )

Another guestbook script, perhaps ?

Burn it ?

Piper
Paranoid (IV) Inmate

From: California
Insane since: Jun 2000

posted posted 01-23-2002 14:50

What are the file permissions on gb.html? Try trapping the errors on the open statements.

Change this:

code:
open(RDBK,"<$GUESTBOOK");


to this:

code:
open(RDBK,"<$GUESTBOOK") or die "Unable to open $GUESTBOOK. Reason: $!";



Do that to both of the open statements in the write_entry sub. I would guess that the problem is in that sub and doing this will help point it out.

Let me know what you come up with.

Regards,
Charlie

[edit]
If this doesnt help, another script wouldn't be a bad idea. Try doing this to the top of that script:

#!/usr/bin/perl -wT
use strict;
use CGI::Carp qw/fatalsToBrowser/;

and see what happens
[/edit]

[This message has been edited by Piper (edited 01-23-2002).]

Petskull
Maniac (V) Mad Scientist

From: 127 Halcyon Road, Marenia, Atlantis
Insane since: Aug 2000

posted posted 01-24-2002 06:47

btw... it is so good to finally see perl/CGI posts around here again... I frikkin' hate php...


Harmonizing new illusions...
ICQ: 67751342

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 01-24-2002 08:39
quote:
I frikkin' hate php...



Why?


docilebob
Maniac (V) Mad Scientist

From: buttcrack of the midwest
Insane since: Oct 2000

posted posted 01-25-2002 04:43

Thanks for stickin it out Piper.

With the first mods , no change.
with the second mods, no change..On the fatalsToBrowser one, are all three lines supposed to have an # in front of them ? When I re-tried it with all lines commented it ( the browser ) said there was an internal server error.

and the server error log shows :

Name "main::LOCK_FILE" used only once: possible typo at /home/carlasings/public_html/cgi-bin/bnbbook.cgi line 436.
Insecure dependency in open while running with -T switch at /home/carlasings/public_html/cgi-bin/bnbbook.cgi line 213.
[Thu Jan 24 22:47:54 2002] [error] [client 67.209.71.10] Premature end of script headers: /home/carlasings/public_html/cgi-bin/bnbbook.cgi

line 436 is open(LOCK_FILE, ">$lockfile");

line 213 is open (OTM,">$tempmail");

the above zip has the updated code.



[This message has been edited by docilebob (edited 01-25-2002).]

Piper
Paranoid (IV) Inmate

From: California
Insane since: Jun 2000

posted posted 01-25-2002 07:18

Forget that part about the CGI::Carp... That was a bad attempt at geek humor on my part. It looks like the problem might be the get_the_lock sub near the bottom. In the write_enrty sub, comment out the &get_the_lock; line (about line #403) and the &drop_the_lock; line (about line #422) and try the script again. Let me know how it goes.

~Charlie

[edit]
I think I am way off base here but try it anyway. The error about main::LOCK_FILE... is because of the -w and use strict; and not about not being able to get a lock.
[/edit]

[edit2]
Get rid of the -wT also. Just make the first line #!/usr/bin/perl and get rid of the use strict; and use CGI::Carp .... This script won't run under strict the way it is now.
[/edit2]

[edit3]
Here, take a look at this: http://www.dev-null.net/dev/bnbbook.txt

I fixed a few things and added some comments. Try it out.
[/edit3]


[This message has been edited by Piper (edited 01-25-2002).]

docilebob
Maniac (V) Mad Scientist

From: buttcrack of the midwest
Insane since: Oct 2000

posted posted 01-26-2002 03:09

Ok, Piper .I tried your *edit 3* changes, and the error log says...

String found where operator expected at /home/carlasings/public_html/cgi-bin/bnbbook.cgi line 448, near "$BAD_EMAIL_FORMAT=""
(Might be a runaway multi-line "" string starting on line 446)
(Missing semicolon on previous line?)
Bareword found where operator expected at /home/carlasings/public_html/cgi-bin/bnbbook.cgi line 448, near "$BAD_EMAIL_FORMAT="YES"
(Missing operator before YES?)
String found where operator expected at /home/carlasings/public_html/cgi-bin/bnbbook.cgi line 455, near "$BAD_EMAIL_FORMAT=""
(Might be a runaway multi-line "" string starting on line 448)
(Missing semicolon on previous line?)
String found where operator expected at /home/carlasings/public_html/cgi-bin/bnbbook.cgi line 455, at end of line
syntax error at /home/carlasings/public_html/cgi-bin/bnbbook.cgi line 448, near "$BAD_EMAIL_FORMAT=""
syntax error at /home/carlasings/public_html/cgi-bin/bnbbook.cgi line 455, next token ???
Execution of /home/carlasings/public_html/cgi-bin/bnbbook.cgi aborted due to compilation errors.
[Fri Jan 25 20:58:34 2002] [error] [client 67.202.89.70] Premature end of script headers: /home/carlasings/public_html/cgi-bin/bnbbook.cgi

So, if I`m guessing right, there`s a missing semi colon screwing things up for a couple lines, and the LOCK_FILE should go back the lower case ?




Nearly everyone considers themselves to be good drivers.
98.3% of you are mistaken.

docilebob
Maniac (V) Mad Scientist

From: buttcrack of the midwest
Insane since: Oct 2000

posted posted 01-27-2002 18:07

Just to wrap this one up, I got it working.

Took the advise of a friend, and started over, fresh script, and read the directions.
Go figure.

Not sure where I messed it up the first time, but apparently skipped over my mistake the second time.

I followed the directions the first time, too.

Really.

I did.

« BackwardsOnwards »

Show Forum Drop Down Menu