php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42453 CGI SAPI does not shut down cleanly with -i/-m/-v cmdline options
Submitted: 2007-08-28 09:14 UTC Modified: 2007-08-31 12:18 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: hans at parse dot nl Assigned: dmitry (profile)
Status: Closed Package: CGI/CLI related
PHP Version: 5.2.4RC3 OS: Linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: hans at parse dot nl
New email:
PHP Version: OS:

 

 [2007-08-28 09:14 UTC] hans at parse dot nl
Description:
------------
The CGI SAPI initializes extensions through the regular MINIT/RINIT functions, but lacks a call to php_request_shutdown() for proper extension shutdown on some command line options. This is the case for command line options -v, -i and -m, which call exit(0) without requesting module/extension shutdown first.

The CLI SAPI *does* clean up nicely after -v/-i/-m and does not exhibit this behavior.

Reproduce code:
---------------
With CGI SAPI:

# php-cgi -v
PHP 5.2.4RC3 (cgi-fcgi) (built: Aug 27 2007 16:51:33)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
    with eAccelerator v0.9.6-dev, Copyright (c) 2004-2007 eAccelerator, by eAccelerator
[23661] EACCELERATOR: PHP unclean shutdown


With CLI SAPI:

# php -v
PHP 5.2.4RC3 (cli) (built: Aug 27 2007 16:51:49)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
    with eAccelerator v0.9.6-dev, Copyright (c) 2004-2007 eAccelerator, by eAccelerator


Expected result:
----------------
nice clean shutdown through RSHUTDOWN/MSHUTDOWN.

Actual result:
--------------
exit(0) without shutting down modules/extensions

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-08-28 11:31 UTC] scottmac@php.net
I had a discussion with Dmitry a few weeks ago and got directed towards an onexit handler for dealing with module cleanup since my issue was aimed at MySQL on Win32.

If other people are having problems then it may be worth while patching it, I've created a patch at http://server.macvicar.net/patches/cgi_main.c.patch
 [2007-08-28 11:46 UTC] jani@php.net
Dmitry, you can commit that patch..or if you don't have time, I can do it. :)
 [2007-08-31 12:18 UTC] dmitry@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 31 23:01:28 2024 UTC