php.net |  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: kameshj at fastmail dot fm
New email:
PHP Version: OS:

 

 [2004-12-16 17:17 UTC] kameshj at fastmail dot fm
Description:
------------
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: http://www.php.net/unsub.php



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.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-12-16 23:07 UTC] edink@php.net
Adding PHP module like that is not supported. You have to do a full stop/start when adding/removing PHP module.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri May 09 09:01:26 2025 UTC