Home > Article > Backend Development > 05-Multiple processes? SAPI life cycle of threads
Multi-process SAPI life cycle
Usually PHP is compiled as a module of apache to handle PHP requests. Apache generally adopts multi-process mode. After Apache is started, it will fork multiple child processes. Each process has an independent memory space. Each child process will go through the start and end stages. However, the beginning stage of each process only occurs after the process forks. To proceed, multiple requests may be processed throughout the lifetime of the process. The shutdown phase occurs only after Apache is shut down or the process is terminated. In between these two phases, the request start-request shutdown phase is repeated with each request.
Multi-threaded SAPI life cycle
Multi-thread mode is similar to a process in multi-process. The difference is that the request start-request closure will be repeated in parallel throughout the life cycle of the process. link.
The above has introduced the SAPI life cycle of 05-Multi-process? Threads, including life cycle and api aspects. I hope it will be helpful to friends who are interested in PHP tutorials.