Luc*_*ssi 4 php performance benchmarking cgi request
我开发了以下CGI脚本并在Apache 2上运行(http://localhost/test.chtml).我在PHP中做了相同的脚本(http://localhost/verifica.php).后来我使用Apache Benchmark工具执行了Apache基准测试.结果显示在图像中.
#include <stdlib.h>
int main(void)
{
printf("%s%c%c\n",
"Content-Type:text/html;charset=iso-8859-1",13,10);
printf("<TITLE>Multiplication results</TITLE>\n");
printf("<H3>Multiplication results</H3>\n");
return 0;
}
Run Code Online (Sandbox Code Playgroud)

有人可以解释为什么PHP提供比CGI脚本更多的请求?
调用独立的CGI程序会导致fork/ exec- 必须完全加载新程序.这不是很有效.
最初PHP以这种方式运行,但是为了加快速度mod_php,PHP解释器最终内置并运行在Apache服务器的进程空间内,而它所要做的就是进行一些简单的解析.