


Request processing of two major processes in PHP kernel_PHP tutorial
Request processing of two major processes in PHP core
static int php_handler(request_rec *r) { /* Initiliaze the context */ php_struct * volatile ctx; void *conf; apr_bucket_brigade * volatile brigade; apr_bucket *bucket; apr_status_t rv; request_rec * volatile parent_req = NULL; TSRMLS_FETCH(); ...... zend_file_handle zfd; zfd.type = ZEND_HANDLE_FILENAME; zfd.filename = (char *) r->filename; zfd.free_filename = 0; zfd.opened_path = NULL; zend_execute_scripts(ZEND_INCLUDE TSRMLS_CC, NULL, 1, &zfd); ...... } ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval **retval, int file_count, ...) /* {{{ */ { ...... EG(active_op_array) = \ zend_compile_file(file_handle, type TSRMLS_CC); ...... zend_execute(EG(active_op_array) TSRMLS_CC); ...... } ZEND_API void execute(zend_op_array *op_array TSRMLS_DC)   {       // 初始化执行上下文       zend_execute_data execute_data;          // 如果有异常就退出执行       if (EG(exception)) {           return;       }          /* Initialize execute_data */       EX(fbc) = NULL; // 初始化正在调用的函数       EX(object) = NULL; // 初始化正在调用的对象       EX(old_error_reporting) = NULL; // 初始化错误报告变量              // 为执行栈分配空间       if (op_array->T < TEMP_VAR_STACK_LIMIT) {           EX(Ts) = (temp_variable *) do_alloca(sizeof(temp_variable) * op_array->T);       } else {           EX(Ts) = (temp_variable *) safe_emalloc(sizeof(temp_variable), op_array->T, 0);       }       // 为临时变量分配空间并初始化这些空间       EX(CVs) = (zval***)do_alloca(sizeof(zval**) * op_array->last_var);       memset(EX(CVs), 0, sizeof(zval**) * op_array->last_var);              EX(op_array) = op_array;              // 切换执行上下文       EX(original_in_execution) = EG(in_execution);       EX(symbol_table) = EG(active_symbol_table);       EX(prev_execute_data) = EG(current_execute_data); // 将当前全局变量中的执行数据压栈       EG(current_execute_data) = &execute_data; // 将当前执行上下文压栈          EG(in_execution) = 1;       // 初始化第一个指令(opcode)       /*      #define ZEND_VM_SET_OPCODE(new_op) \      CHECK_SYMBOL_TABLES() \      EX(opline) = new_op            execute_data.opline 为当前执行的 opcode      */       if (op_array->start_op) {           ZEND_VM_SET_OPCODE(op_array->start_op);       } else {           ZEND_VM_SET_OPCODE(op_array->opcodes);       }          if (op_array->uses_this && EG(This)) {           EG(This)->refcount++; /* For $this pointer */           if (zend_hash_add(EG(active_symbol_table), "this", sizeof("this"), &EG(This), sizeof(zval *), NULL)==FAILURE) {               EG(This)->refcount--;           }       }          // 将存储opline的内存地址赋给 executor_globals.online_ptr ,可以实时跟踪opcode的执行       EG(opline_ptr) = &EX(opline);          EX(function_state).function = (zend_function *) op_array;       EG(function_state_ptr) = &EX(function_state);   #if ZEND_DEBUG       /* function_state.function_symbol_table is saved as-is to a stack,       * which is an intentional UMR.  Shut it up if we're in DEBUG.       */       EX(function_state).function_symbol_table = NULL;   #endif              while (1) {   #ifdef ZEND_WIN32           if (EG(timed_out)) {               zend_timeout(0);           }   #endif                      // 循环调用每个opline的 handler 函数,如果是推出函数的话,返回值大于0,就退出           if (EX(opline)->handler(&execute_data TSRMLS_CC) > 0) {         return;           }          }       zend_error_noreturn(E_ERROR, "Arrived at end of main loop which shouldn't happen");   }  

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



To install the Linux kernel on Ubuntu22.04, you can follow the following steps: Update the system: First, make sure your Ubuntu system is the latest, execute the following command to update the system package: sudoaptupdatesudoaptupgrade Download the kernel file: Visit the official Linux kernel website () to download Required kernel version. Select a stable version and download the source code file (with .tar.gz or .tar.xz extension), for example: wget Unzip the file: Use the following command to unzip the downloaded kernel source code file: tar-xflinux-5.14.tar. xz install build dependencies: Install the tools and dependencies required to build the kernel. Execute

Modify the kernel startup sequence of Linux 1. Modify the kernel startup sequence of RHEL6/CentOS6. Check the /etc/grub.conf file to determine the system kernel situation. According to the document, there are two kernel versions in the system, namely 2.6.32-573.18.1.el6.x86_64 and 2.6.32-431.23.3.el6.x86_64. Kernel versions are listed from top to bottom. In the grub.conf file, you can decide which kernel version to use when the system starts by adjusting the default parameters. The default value is 0, which means the system will boot the latest kernel version. A value of 0 corresponds to the first content listed in the grub.conf file.

Is the Android system based on the Linux kernel? Android system, as one of the most widely used mobile operating systems in the world, has always been said to be developed based on the Linux kernel. However, what is the real situation? Let’s explore this issue. First, let's understand the Linux kernel. The Linux kernel, as an open source operating system kernel, was first released by Linus Torvalds in 1991. It provides a good foundation for many operating systems, including And

Linux kernel main function analysis and analysis The Linux kernel is a large and complex system, in which the main function plays a vital role. It is the entry point of the entire system and is responsible for initializing various subsystems, drivers and kernel modules. Finally start the entire operating system. This article will analyze and analyze the main function of the Linux kernel, and demonstrate its key functions and execution flow through specific code examples. In the Linux kernel, the entry point of the main function is start_k in the init/main.c file.

Title: Exploring the programming language used at the bottom of the Linux kernel. As an open source, stable and reliable operating system kernel, the Linux kernel has a wide range of applications in the computer field. To have an in-depth understanding of the Linux kernel, you have to involve the programming language used at the bottom. In fact, the Linux kernel is mainly written in C language, which is an efficient, flexible and easy-to-maintain programming language that is very suitable for operating system development. This article will explore the bottom of the Linux kernel from a detailed perspective

Detailed explanation of the storage location of Linux kernel source code. Linux kernel source code is the core part of the Linux operating system. It contains the implementation code for various functions of the operating system. To understand where the Linux kernel source code is stored, we first need to understand the organizational structure of the Linux kernel. Linux kernel source code is usually stored in the /usr/src/linux or /usr/src/linux- directory. In this directory, there are many

Compiling and installing the Ubuntu kernel requires certain professional skills and practical experience. Here are the general steps, but please proceed with caution as this process may carry certain risks. Before you begin, be sure to back up important data and systems. Get the source code: Visit the Ubuntu official website () or the kernel developer website () to download the latest kernel source code. Unzip the source code to a suitable directory, such as /usr/src. Install compilation dependencies: Install the dependencies required to build the kernel. Open a terminal and execute the following command: sudoapt-getinstallbuild-essentiallibncurses-devbisonflexlibssl-devlibelf-d

Upgrading the kernel on CentOS7 requires the following steps: Check the current kernel version: Open a terminal and run the following command: uname -r Add ELRepo source: Run the following command to add the ELRepo source: rpm --import Install new kernel: Run the following command to install Latest stable kernel: yum --enablerepo=elrepo-kernelinstallkernel-ml Update boot manager (GRUB) configuration: Run the following command to update the GRUB configuration file: grub2-mkconfig -o/boot/grub2/grub.cfg Restart the system: Run The following command is used to restart the system: reboot verification
