简体   繁体   English

Apache Mod PHP和脚本调用

[英]Apache mod php and script invocation

Say I am running a PHP script, foo.php, inside apache configured with mod php, then, say I invoke the script from my browser(or any other means), does apache spawn off a new process in which the script gets executed? 假设我在配置了mod php的apache内运行一个PHP脚本foo.php,然后说我从浏览器(或任何其他方式)调用了该脚本,apache是​​否产生了一个新的执行脚本的进程? How does it work? 它是如何工作的? Can someone pls point me to some good article on this? 有人可以指出我对此的一些好文章吗?

does apache spawn off a new process in which the script gets executed? apache会产生一个新进程来执行脚本吗? How does it work? 它是如何工作的?

No, not each time. 不,不是每次都这样。 With mod_php, each httpd child process will have its own PHP interpreter. 使用mod_php,每个httpd子进程将具有自己的PHP解释器。 When a PHP page is requested, the child process hands off the PHP to the interpreter and sends the output back to the visitor. 当请求PHP页面时,子进程将PHP交给解释器,然后将输出发送回访问者。 After the request is finished, the child process remains in memory awaiting another request. 请求完成后,子进程将保留在内存中,等待另一个请求。

I'm not sure if there are articles that explain the internals of mod_php. 我不确定是否有文章解释mod_php的内部原理。 This information will be somewhat general to all modules of this type. 此信息对于该类型的所有模块都有些通用。 There are, however, many articles on speed comparisons between mod_php, fastcgi, suphp and others, if this is your concern. 但是,如果您担心的话,有很多文章介绍了mod_php,fastcgi,suphp和其他软件之间的速度比较。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM