Home > Backend Development > PHP Problem > How to understand PHP architecture layout

How to understand PHP architecture layout

醉折花枝作酒筹
Release: 2023-03-09 15:52:01
forward
1887 people have browsed it

This article will introduce you to the PHP architecture layout. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to everyone.

How to understand PHP architecture layout

Execution process

It can be seen from the above figure that there are mainly four stages from parsing PHPCode to execution.

How to understand PHP architecture layout

To obtain token, you can obtain token information through the Token_get_all('<?php echo "str";>') function.

Abstract syntax tree mainly decouples the interpreter and compiler.

The instructions that opcodes are ultimately executed, such as ZEND_ECHO: are essentially a corresponding C function.

Architecture structure

How to understand PHP architecture layout
The Zend layer provides some basic memory management and data structures for the upper PHP layer.

The SAPI layer communicates with the server for the upper layer, encapsulating different communication types. cgi, fast-cgi, cli, etc.

Directory structure

sapi

stores the upper-layer API interaction forms supported by different environments, and implements different input and output forms.

Zend

Stores PHP-related core code, memory management, etc. as mentioned above.

main

is responsible for the entrance to interact with the Zend layer, and Some hook functions.

ext

Mainly expand related directories. Generate custom modules through the ext_skel command. They will be installed in this directory by default.

TSRM

Directories related to thread resource management, generally only when used in conjunction with Apache, will involve code related to thread resource management.
Those related to Nginx will generally only use the FastCGI protocol and not involve it. TSRM module.

Recommended learning: php video tutorial

The above is the detailed content of How to understand PHP architecture layout. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:csdn.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template