Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision |
internals:extensions [2013/04/10 12:59] – jpauli | internals:extensions [2013/04/10 13:29] – jpauli |
---|
==== Activating PHP extensions ==== | ==== Activating PHP extensions ==== |
After registration, comes activation, and here is the step where the engine will effectively sort the PHP extensions in an order that make the dependencies be activated in a specific order. | After registration, comes activation, and here is the step where the engine will effectively sort the PHP extensions in an order that make the dependencies be activated in a specific order. |
**PHP extensions are activated before Zend extensions** | PHP extensions are activated before Zend extensions |
| |
''zend_startup_modules()'' does the job of activating PHP extensions. It starts by sorting them in the ''module_registry'' Hashtable calling a sorting callback. This sort process will check for dependencies requirement, and sort the registry in a way that dependency requirements are activated first. | ''zend_startup_modules()'' does the job of activating PHP extensions. It starts by sorting them in the ''module_registry'' Hashtable calling a sorting callback. This sort process will check for dependencies requirement, and sort the registry in a way that dependency requirements are activated first. |
==== Activating Zend extensions ==== | ==== Activating Zend extensions ==== |
Zend extensions are then activated **after** PHP extensions | Zend extensions are then activated **after** PHP extensions |
zend_extension_startup() is called on the Zend extensions registry | ''zend_extension_startup()'' is called on the Zend extensions registry |
Remember that Zend extensions are never sorted in any way. You must then declare them in the FIFO order in php.ini. The engine wont touch your declaration order | Remember that Zend extensions are never sorted in any way. You must then declare them in the FIFO order in php.ini. The engine wont touch your declaration order |
''zend_extension_startup()'' just calls for the ''startup()'' function on Zend extensions, and appends a declaration message in the Zend phpinfo() message "With module XXX" showing to end user the Zend extension is both registered, and activated. | ''zend_extension_startup()'' just calls for the ''startup()'' function on Zend extensions, and appends a declaration message in the Zend phpinfo() message "With module XXX" showing to end user the Zend extension is both registered, and activated. |
| Dont be fooled here, it's not the ''activate()'' function wich is triggered from Zend extensions, but the ''startup()'' function |
| |
| ===== Extensions lifetime ===== |
| You may know PHP's lifetime. Very basically, ''php_module_startup()'', then ''php_request_startup()'' at each request, followed by ''php_request_shutdown()'' , and then when PHP has to die : ''php_module_shutdown()''. |
| We already detailed php_module_startup() previously, to show how both PHP extensions and Zend extensions live into this stage. |
| |
| ==== Request startup ==== |
| Zend extensions come first, and their ''activate()'' function is called |
| PHP extensions come second, and their ''request_startup_func()'' is called, this is known as beeing the "RINIT" stage |
| |
| ==== Request shutdown ==== |
| PHP extensions come first, and their ''request_shutdown_func()'' is called, this is known as beeing the "RSHUTDOWN" stage |
| Zend extensions come after, and their ''deactivate()'' function is called |
| A third hook is called : ''post_deactivate_func()'', for each PHP extensions. PHP extensions are here given a chance to do some work after Zend extensions have all shut down |
| |
| ===== Main schema ===== |