#42453 [Com]: CGI SAPI does not shut down cleanly with -i/-m/-v cmdline options

From: Date: Thu, 30 Aug 2007 06:22:08 +0000
Subject: #42453 [Com]: CGI SAPI does not shut down cleanly with -i/-m/-v cmdline options
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-116855@lists.php.net to get a copy of this message
 ID:               42453
 Comment by:       schneecrash+php at gmail dot com
 Reported By:      hans at parse dot nl
 Status:           Assigned
 Bug Type:         CGI related
 Operating System: Linux
 PHP Version:      5.2.4RC3
 Assigned To:      dmitry
 New Comment:

after applying 'cgi_main.c.patch' from above to latest php52x-branch, i
see, 

 % php -v
 	PHP 5.2.4 (cli) (built: Aug 29 2007 18:13:08) 
 	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
 		with Xdebug v2.1.0-dev, Copyright (c) 2002, 2003, 2004, 2005, 2006,
2007, by Derick Rethans

as before for php(cli).

but for php(cgi), i now see,

 % php-cgi -v
 	PHP 5.2.4 (cgi-fcgi) (built: Aug 29 2007 18:13:31)
 	Copyright (c) 1997-2007 The PHP Group
 	Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies

where i do *not* get the,

  [23661] EACCELERATOR: PHP unclean shutdown

but i also am 'missing' the 

	with eAccelerator ...
	with Xdebug ...


where,

 % php -m | egrep -i "eaccelerator|xdebug"
    eAccelerator
    xdebug
    Xdebug
    eAccelerator

 % php-cgi -m | egrep -i "eaccelerator|xdebug"
    (empty)


given,

 % egrep -i "eaccelerator|xdebug" php-cli.ini
 
zend_extension_ts="/usr/local/lib/php/extensions/no-debug-zts-20060613/eaccelerator.so"
 
zend_extension_ts="/usr/local/lib/php/extensions/no-debug-zts-20060613/xdebug.so"

and,

  % diff -ur php-cgi.ini php-cli.ini  
  %


Previous Comments:
------------------------------------------------------------------------

[2007-08-28 11:46:05] jani@php.net

Dmitry, you can commit that patch..or if you don't have time, I can do
it. :)

------------------------------------------------------------------------

[2007-08-28 11:31:55] 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 09:14:20] 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


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=42453&edit=1


Thread (6 messages)

« previous php.bugs (#116855) next »