Weitere ähnliche Inhalte Ähnlich wie PHP and Zend Internal I - 体系结构及生命周期 (20) PHP and Zend Internal I - 体系结构及生命周期4. Web编程断代史…
• 静态页面时代
GET /index.html HTTP/1.1 …
Client Web Server
HTTP/1.1 200 OK …
本地I/O或socket
Index.html
5. Web编程断代史…
• CGI时代
GET /index.html?id=3 HTTP/1.1 …
Client Web Server
HTTP/1.1 200 OK …
CGI - fork & execve
socket
Database CGI Application
6. Web编程断代史…
• 动态脚本时代
GET /index.html?id=3 HTTP/1.1 …
Client Web Server
HTTP/1.1 200 OK …
CGI - fork & execve
Database
? CGI Interface
Application
10. 走近一步看PHP…
• PHP的执行流程
SAPI PHP Core Zend Engine
Startup
Set HTTP Environment
Start PHP Core
MINIT
RINIT
Start Zend Engine
Compile
Execute
RSHUTDOWN
MSHUTDOWN
Shutdown
12. 接口模式及生命周期模式…
• CGI的困局 – One Request One Process
GET /index.html?id=3 HTTP/1.1 …
Client Web Server
HTTP/1.1 200 OK …
CGI - fork & execve
Database
PHP SAPI
16. 接口模式及生命周期模式…
• Multiprocess
Process Startup Process Startup Process Startup
MINIT MINIT MINIT
RINIT RINIT RINIT
SCRIPT SCRIPT SCRIPT
RSHUTDOWN RSHUTDOWN RSHUTDOWN
… … …
RINIT RINIT RINIT
SCRIPT SCRIPT SCRIPT
RSHUTDOWN RSHUTDOWN RSHUTDOWN
MSHUTDOWN MSHUTDOWN MSHUTDOWN
Process Shutdown Process Shutdown Process Shutdown
17. 接口模式及生命周期模式…
• Multithreaded
Process Startup
MINIT
RINIT RINIT RINIT
SCRIPT SCRIPT SCRIPT
RSHUTDOWN RSHUTDOWN RSHUTDOWN
MSHUTDOWN
Process Shutdown
18. What is Next?
• 线程安全模型(ZTS & TSRM)
• 内核类型系统及表环境
• 垃圾回收机制(GC)
• SAPI结构分析
• PHP扩展模块开发
• 与内核相关的优化
• OpCode
• ……