|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31128 apache2 restart causing divide by zero when php is introduce newly
Submitted: 2004-12-16 17:17 UTC Modified: 2004-12-16 23:07 UTC
From: kameshj at fastmail dot fm Assigned:
Status: Not a bug Package: Apache2 related
PHP Version: 5.0.3 OS: Any Operating System
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: kameshj at fastmail dot fm
New email:
PHP Version: OS:


 [2004-12-16 17:17 UTC] kameshj at fastmail dot fm
I found apache2 crashes with Divide by Zero error in the following scenario. 
This is with the PHP built with ZTS mode. Hope some other defect will occur for Non-ZTS.

With regards
Kamesh Jayachandran

PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:

Reproduce code:
1)Disable php module and start apache2.
2)enable php in the httpd.conf
3)httpd restart(Not stop and start)
4)make a request to any php page apache crashes with divide by zero.

I drilled down on this issue.
My investigation is,
Apache on startup calls php_apache_server_startup twice 
one to set a user data for a userdata_key "apache2filter_post_config"
and another to call tsrm_startup and all.
While restart it simply calls this function once which misses out call
to tsrm_startup and hence tsrm_tls_table_size is just zero inside TSRM
which causes divide by zero error in THREAD_HASH_OF macro.

This can be attributed to the loading/unloading/reloading of apache modules to do some syntax check on its configuration(Correct me if I am wrong This info I got from Rasmus in one of the mail thread.)

While startup post_config hook is called twice, But once when restart is called.

Expected result:
Apache2 should not crash

Actual result:
Apache2 crashes with Divide by Zero error.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-12-16 23:07 UTC]
Adding PHP module like that is not supported. You have to do a full stop/start when adding/removing PHP module.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jul 15 09:01:28 2024 UTC