The kernel composition in PHP and the introduction of PHP code execution process

Source: Internet
Author: User
Tags php script zend

This article gives you the content is about the kernel in PHP and the implementation of PHP code introduction, there is a certain reference value, the need for friends can refer to, I hope to help you.


1, the core composition of PHP

PHP includes a total of 3 modules: PHP kernel, Zend Engine, PHP extension layer

1.1 PHP Kernel: Used to handle requests, file streams, error handling and other related processing.
1.2. Zend Engine: Convert source files to machine language and run on Zend virtual machines

The Zend is made up of two parts:
Compiler: Responsible for compiling PHP code into executable opcodes
Actuator: Responsible for executing the compiler output opcodes, which is the code logic written in the PHP script

1.3. Expansion
An extension layer is a set of functions, class libraries, and streams that PHP uses to perform specific operations, such as installing the PHP_OPENSSL extension to use the Open SSL function, a common extension,


The extension is installed in the PHP installation path ext directory.

2. PHP Code Execution process

The approximate execution process for PHP is as follows:
We write PHP code, is not able to directly execute, to go through the lexical, parser, and then compiled by the compiler, see here might want to tease me this is? is PHP not a scripting language? How do you still have to be compiled like C + +? In fact, strictly speaking, PHP is compiled language, after lexical parsing, then compiled, compiled into the opcode intermediate code, and then executed by the Zend execution engine, then from this point, PHP is compiled after the execution, this is similar to Java, but Java is the code (. Java) Compiled into bytecode, and then executed by the JVM.

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.