php/php-src
6 articles
PHP Source Architecture Overview
A deep dive into php-src's internal architecture, exploring the core components and design patterns that power the PHP runtime.
Navigating php-src: Architecture, Layers, and the Request Lifecycle
A high-level tour of the php-src repository structure, its four architectural layers, the SAPI contract, and the complete request lifecycle from process startup through shutdown.
Inside the zval: PHP's Type System and Memory Model
A deep dive into PHP's fundamental data structures — the 16-byte zval, zend_string, HashTable, zend_object, the reference counting system, memory allocator, and garbage collector.
From Source to Opcodes: PHP's Lexer, Parser, AST, and Compiler
Traces the complete compilation pipeline from PHP source to executable opcodes — the re2c lexer, Bison parser, AST node system, and the recursive compiler that emits zend_op instructions.
The Zend Virtual Machine: Execution, Code Generation, and Optimization
Explores the VM execution engine — template-based code generation, five dispatch modes, register pinning, the call frame layout, hookable function pointers, and the SSA-based optimizer.
The Extension System, OPcache, and JIT: How PHP is Extended and Optimized
Covers the PHP extension API, OPcache's shared memory architecture, the JIT compiler, Fibers, the streams abstraction, and TSRM thread safety.