1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
|
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!-- $Revision: 1.2 $ -->
<sect1 xml:id="internals2.structure.lifecycle" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Life cycle of an extension</title>
<simpara>
A Zend extension goes through several phases during its lifetime. All of
these phases are opportunities for the developer to perform various
initialization, termination, or informational functions. The Zend API allows
for hooks into five separate phases of an extension's existence, apart from
calls by PHP functions.
</simpara>
<sect2 xml:id="internals2.structure.lifecycle.mod-vs-req">
<title>Loading, unloading, and requests</title>
<simpara>
As the Zend engine runs, it processes one or more "requests" from its
client. In the traditional CGI implementation, this corresponds to one
execution of a process. However, many other implementations, most notably
the Apache module, can map many requests onto a single PHP process. A Zend
extension may thus see many requests in its lifetime.
</simpara>
</sect2>
<sect2 xml:id="internals2.structure.lifecycle.overview">
<title>Overview</title>
<itemizedlist>
<listitem>
<simpara>
In the Zend API, a module is loaded into memory only once when the
associated PHP process starts up. Each module recieves a call to the
"module initialization" function specified in its
<constant>zend_module</constant> structure as it is loaded.
</simpara>
</listitem>
<listitem>
<simpara>
Whenever the associated PHP process starts to handle a request from its
client - i.e. whenever the PHP interpreter is told to start working - each
module receives a call to the "request initialization" function specified
in its <constant>zend_module</constant> structure.
</simpara>
</listitem>
<listitem>
<simpara>
Whenever the associated PHP process is done handling a request, each
module receives a call to the "request termination" function specified in
its <constant>zend_module</constant> structure.
</simpara>
</listitem>
<listitem>
<simpara>
A given module is unloaded from memory when its associated PHP process is
shut down in an orderly manner. The module receives a call to the "module
termination" function specified in its
<constant>zend_module</constant> structure at this time.
</simpara>
</listitem>
</itemizedlist>
</sect2>
</sect1>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
|