PHP kernel is like a maze, if there is not a picture of the overall picture, just face one of the points, it will be like a maze, walk to walk to the dead end. Wandering around in this maze for a long time, recently got a PHP treasure map, and then look at this map to visit the PHP kernel, suddenly feel that the landscape of a lot of clear. Nonsense not to say,:
This diagram includes two parts, corresponding to the PHP startup process, and the process for PHP to process each request. The PHP startup process is a series of initialization operations that establish the various global variables that are used when processing requests:
Apache Boot
= Sapi_startup
= = Php_module_startup (main switch of PHP)
= Php_output_startup
= = Zend_startup (start Zend Engine)
= Register_ini_entries
= Php_ini_stream_wrappers
= = Php_ini_register_extensions (start dynamically loaded extensions)
= Zend_startup_modules
= Zend_startup_extensions
Here is the process for handling each request:
Php_handler
= Php_apche_request_ctor
= Zend_activate
= Zend_execute_scripts
= = Zend_compile (Syntax analysis, semantic analysis, generative Oparray)
= zend_execute (Executive opcode)
= Zend_deactivate
Turn off Zend, PHP when the process exits:
Sapi_shutdown
= Zend_shutdown
A treasure map for exploring the maze of PHP cores