php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #18336 Loop in PHP code causes crash in Apache2 instead of PHP error message
Submitted: 2002-07-14 05:40 UTC Modified: 2002-07-14 05:42 UTC
Votes:3
Avg. Score:3.3 ± 0.5
Reproduced:1 of 2 (50.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: peter at helpnet dot com dot au Assigned:
Status: Wont fix Package: Reproducible crash
PHP Version: 4.2.1 OS: Windows NT
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: peter at helpnet dot com dot au
New email:
PHP Version: OS:

 

 [2002-07-14 05:40 UTC] peter at helpnet dot com dot au
I wrote a function that called itself occasionally. When I accidentally changed the selection criteria the wrong way, the function went in to a loop calling itself. Instead of getting a PHP error message, Apache2 crashed with:
Apache.exe Exception stack overflow(oxc000000fd), Address: 0x00801366

There were no error messages in any logs, Apache, NT, or PHP.

At first I thought it an Apache error as I upgraded to Apache 2 with the release of Apache 2.0.35 and PHP 4.2.0. That combination produced occasional random errors on some new extensions, including DOMXML, but nothing I needed for a production environment.

An upgrade to PHP 4.2.1 made matters worse as it made every test site crash. An upgrade to Apache 2.0.39 did nothing to help PHP's problems. I tried php4-win32-latest.zip today, 2002-07-14, but it crashed Apache on start up. (Apache worked with everything non PHP.) php4-win32-STABLE-latest.zip solved the start up crash and solved the crashes with the other test sites.

Back to the code that induced the first problem. I had just turned sessions on in the test site and thought the PHP session code had failed under Apache but most of the other sites were running happily with PHP 4.2.0 sessions under Apache2. Eventually I discovered the exact line causing the problem. In the past when I created an infinite loop in PHP, it either produced a PHP time out message or a PHP memory limit error. Because I have hundreds of Mb available and set php.ini's memory usage to many times the default, tiny test programs rarely run out of memory before timing out.

Under PHP 4.2.0 onwards and Apache 2, the result is an Apache crash instead of a PHP error.

The Apache 2 httpd.conf contains the defaults for all process related settings.

php.ini contains the defaults except for an increase in the memory allocation to 30 Mb and changing error reporting to report all errors.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-07-14 05:42 UTC] derick@php.net
PHP can not guard for these mistakes as discussed on a few occasions on the PHP Developers mailing list.

Derick
 [2002-11-15 10:50 UTC] phorum at jkt dot wz dot cz
apache/1.3.23, winnt, php/4.1.2 (or maybe 4.1.3-dev??):
when calling a function recursive (infinite loop), the apache child will be shut down with an windows' dr.watson error message 'stack overflow in apache.exe'.
in apache error log it will be noticed.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 13:01:29 2024 UTC