PHP life cycle

Source: Internet
Author: User
Tags zend

2015-08-19 15:05:30 Wednesday

A very good essay.

PHP Kernel Exploration

Summarize

1. Module Initialization Minit

Each PHP module/extension initializes internal variables and tells PHP where the function body is (to register its own function with PHP) when calling its own function.

2. Request initialization of Rinit

Initialize session, global variable ... And so on only some variable settings for the current request

Zend Engine converts PHP code to opcode

When a related module handler function is called, Zend Engine handles the request parameter information to these modules and then receives the returned result.

Zend Engine will return the results to the PHP kernel

The PHP kernel is then passed to the Web server

3. End Request Rshutdown

Releases resources such as memory or files that are requested at initialization

4. End Module Mshutdown

Reclaim the resources requested when the module is initialized

Multi-Process & multithreading

If it's every request for a process, every request comes with a 4-step top.

If it is multi-threaded, just perform a 1th step, after all the PHP modules are initialized, each processing incoming request will only execute rinit, after processing is done just release rinit resources, and do not release Minit requested resources for the next request to use, unless the Web server shuts down, Before executing Mshutdown

PHP life cycle

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.