How serious is a 'division by zero' error?

I use WAMP and my Apache service recently stopped working. I posted my Apache error log on the official WAMP forums and someone noted that one of the last things to occur was a ‘division by zero’ error in PHP. He said that this is often a fatal error and could be the reason the Apache service is not working. Is this true? Is a ‘division by zero’ error really that serious?

Thanks!

Serious enough to throw a fatal error in a PHP script, but that won’t crash your WAMP server.

‘fatal’ is relative to scope.

It was fatal to the execution of your script, yes. But not fatal to the operation of the WAMP server.

Division by zero does not cause fatal error in PHP, it only generates a warning and the script execution is continued.

True - note the following…

First, Servers can be configured to stop on warnings - and/or Apache may be logging the error and that’s what mattSanchez has noted.
Second, if the PHP is trying to create a well-formed response - say stream a video or image, or generate an XML or JSON response, the emission of the warning could certainly destroy the integrity of the file since by default PHP injects text of the warning into the output immediately upon encountering it. Such a bad response could cause a fatal error in the code relying on the response.

Star is correct that such an error cannot bring the whole webserver down. However, any access of that particular script may be fruitless until the error is removed.

Finally, keep in mind that PHP’s default behavior is to return null on an illegal operation. Hence if your error occurs on a line like this.

$a = $b / $c; 

$a will be assigned null when $c is zero. If it is numerically evaluated that null will be treated as 0. So, in a sense, division by zero in PHP yields 0 in a roundabout way, but avoiding the error by preventing the situtation - for example.

$a = $c == 0 ? 0 : $b / $c; 

or for those who dislike ternaries.

if ($c == 0) {
  $a = 0;
} else {
  $a = $b / $c;
}
 

Yes i agree with lemon juice.It is not a fatal error infact it is just a error and it generates script execution and nothing to worry about.

Broken JSON and XML files would fall under the heading of something to worry about. Server settings can be used to suppress the error, but I still would see such an error as cause for concern because if a programmer is careless enough to let a division by zero error remain in the code there are probably far more serious and dangerous lapses hiding in the wings.