Re: [PHP4BETA] sapi_xxx_module()
| From: | Zeev Suraski | Date: | Sat, 28 Aug 1999 01:01:54 +0000 |
| Subject: | Re: [PHP4BETA] sapi_xxx_module() | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-3791@lists.php.net to get a copy of this message | ||
I haven't looked at your patches yet, but to answer your question - sapi_startup() and sapi_shutdown() are server-wide functions, and are called once on the server startup and once on the server shutdown (and not on every request).
The reason you see a startup and a shutdown and then another startup is due to an Historical bug in Apache, that started modules, stopped them, and then started them off again. Because some modules learned to rely on this buggy behavior, it was later on kept (AFAIK anyway).
Any particular reason you can't use a standard PHP module to implement this? You have server-wide and per-request callbacks for startup and shutdown, why do you want to plug into SAPI?
Zeev
At 01:39 28/08/99 , Sascha Schumann wrote:
-- Zeev Suraski <zeev@zend.com> http://www.zend.com/ For a PGP public key, finger bourbon@netvision.net.ilTo be able to run startup/shutdown functions from sapi_startup() and sapi_shutdown(), I've implemented a logic similar to the one used in internal_functions.c.It allows modules (I needed it for the shared memory part of the session module) to register startup/shutdown functions which are called at server startup/shutdown. I've tested it with Apache and it appears to do what I need.Diffs to SAPI.[ch] and SAPI_modules.c attached.While testing in httpd -X mode I noticed that the Apache module version calls SAPI immediately in the following order:sapi_startup() sapi_shutdown() sapi_startup()... end then nothing until the server goes down. It apparently doesn't call sapi_shutdown() anymore. Hopefully someone can shed some light on this.--Regards,Sascha Schumann Consultant-- PHP 4 Beta