Gossamer Forum
Home : Products : Links 2.0 : Customization :

fatal error. Illegal division by zero. What is thi

Quote Reply
fatal error. Illegal division by zero. What is thi
Error Message : fatal error: Illegal division by zero at nph-build.cgi line 432, chunk 57.

Script Location : nph-build.cgi
Perl Version : 5.00404

Form Variables
-------------------------------------------
staggered : 1


Quote Reply
Re: fatal error. Illegal division by zero. What is thi In reply to
Try searching for 'Illegal Division by zero' with the forums's Search option Wink

Here is something that may be helpful;

http://www.gossamer-threads.com/...ew=&sb=&vc=1

Andy

webmaster@ace-installer.com
http://www.ace-installer.com
Quote Reply
Re: fatal error. Illegal division by zero. What is thi In reply to
Illegal division by zero means that the program is trying to do division where the demominator is zero....! You cannot divide by zero.

This occurs on line 432 of the nph-build.cgi file. That line apprears in the sub build_update_ratings. But yours may be different if you have made changes. show us what that section of code looks like and maybe someone can help you.

Your site ( a nice looking site...! ) looks like it has been around awhile. Did this just start. If so, what changes have you recently made.

Gene
Quote Reply
Re: fatal error. Illegal division by zero. What is thi In reply to
The code is this: but I upload th file nph-build.cgi an the error persist:

sub build_update_ratings {
# --------------------------------------------------------
# Updates the ratings of each link.
#

# Let's collect the ratings.
my ($id, %rating, %votes, @values, $input);
opendir (HITS, $db_rates_path) or &cgierr ("unable to open ratings directory: $db_rates_path. Reason: $!");
while (defined ($id = readdir HITS)) {
next unless ($id =~ /^\d+$/);
open (HIT, "$db_rates_path/$id") or &cgierr ("unable to open rating counter: $db_rates_path/$id. Reason: $!");
my $input = <HIT>;
chomp $input;
($votes{$id}, $rating{$id}) = split /\s/, $input;
close HIT;
}
closedir HITS;

# Update the links database.
open (DB, "$db_links_name") or &cgierr ("unable to open links database: $db_links_name. Reason: $!");
open (DBTMP, ">$db_links_name.bak") or &cgierr ("unable to open temp links database: $db_links_name.bak. Reason: $!");
LINE: while (<DB>) {
/^#/ and print OUT and next LINE; # Skip comment Lines.
/^\s*$/ and next LINE; # Skip blank lines.
chomp; # Remove trailing new line.
@values = split /\Q$db_delim\E/;
$id = $values[0];

if (exists $votes{$id}) {
$values[$db_rating] = (($values[$db_rating] * $values[$db_votes]) + $rating{$id}) /
($values[$db_votes] + $votes{$id});
$values[$db_rating] = sprintf ("%.2f", $values[$db_rating]);
$values[$db_votes] = $values[$db_votes] + $votes{$id};
print "\tUpdating rating to $values[$db_rating] for link id $id\n";
}
print DBTMP &join_encode(&array_to_hash(0, @values));
}
close DB;
close DBTMP;

if (-s "$db_links_name.bak" > 0) {
if (! rename ("$db_links_name.bak", $db_links_name)) {
print "\tCouldn't rename! Had to copy. Strange: $!\n";
open (DBTMP, ">$db_links_name") or &cgierr ("unable to open links database: $db_links_name. Reason: $!");
open (DB, "$db_links_name.bak") or &cgierr ("unable to open temp links database: $db_links_name.bak. Reason: $!");
while (<DB>) { print DBTMP; }
close DB;
close DBTMP;
}
}
else {
&cgierr ("Error building! Links database is 0 bytes!");
}

# Delete the ratings.
foreach (keys %votes) {
unlink ("$db_rates_path/$_") or &cgierr ("unable to remove rating: $db_rates_path/$_. Reason: $!");
}
}


Quote Reply
Re: fatal error. Illegal division by zero. What is thi In reply to
I read this, and check all, but the error persist.

I think closed the site, I disesperated

Quote Reply
Re: fatal error. Illegal division by zero. What is thi In reply to
Restore an original copy.

Installs:http://www.wiredon.net/gt/
MODS:http://wiredon.net/gt/download.shtml

Quote Reply
Re: fatal error. Illegal division by zero. What is thi In reply to
what does this mean
In Reply To:
I think closed the site, I disesperated
Just use your best simple english and spanish. We'll do our best to understand. I can get the spanish translated if needed.

As Paul says, restore an original copy. If you have made lots of changes, try doing just one sub routine at a time, starting with the most recent change and working backwards. Or restore the routine that line 372 appears in.

Hope you understand.

Good Luck.


Gene
Quote Reply
Re: fatal error. Illegal division by zero. What is thi In reply to
I think he meant "Im going to close the site, I'm desperate", but I'm not sure.

Installs:http://www.wiredon.net/gt/
MODS:http://wiredon.net/gt/download.shtml

Quote Reply
Re: fatal error. Illegal division by zero. What is thi In reply to
an orginal copy of what archives? an a lot of changes in...

Quote Reply
Re: fatal error. Illegal division by zero. What is thi In reply to
yusep, ¡attencion!

you need to help us.

1. Have you made any changes to the nph-build.cgi file recently?

( ¿cambiar a nph-build.cgi recientemente? Esta es muy importante. )

You must locate a second copy of the nph-build.cgi file.

2. Do you have an old copy ( back-up copy - archivo de seguridad ) of nph-build.cgi file?

3. Do you have the original links2.zip file?

My spanish is worse than your english LOL

Gene
Quote Reply
Re: fatal error. Illegal division by zero. What is thi In reply to
yes I replace the original file, but not works

Sorry for my english :-)

Quote Reply
Re: fatal error. Illegal division by zero. What is thi In reply to
Well, you have not done what we ask and you are not answering our questions.

You replaced the original file. Which file? All of them. Just the nph-build.cgi file. Depending on what changes you previously made, you may not be able to use the original cgi/pl files.

You say it doesn't work. That does not help us. Tell us specifically what error you are getting.


Gene