apache切换到nginx, php的编程模型是一样的么?

WBOY
Release: 2016-06-06 20:52:36
Original
835 people have browsed it

听说nginx不需要多个进程, 那不是多个请求都用同一个进程, 不会干扰么?

php代码需要改写么?

回复内容:

听说nginx不需要多个进程, 那不是多个请求都用同一个进程, 不会干扰么?

php代码需要改写么?

完全不需要,跟php没有任何关系,php是个脚本语言,自己有虚拟机处理这些东西,你完全不需要关心在什么平台运行

不是完全没影响 有些变量如_SERVER[PHP_SELF]与是apache还是nginx有关系的

使用PHP,可以说你只需要关注PHP解释器便可以了,无论是结合哪个web server,都需要调用解释器来执行脚本的。

不仅不会干扰...相反这种单进程(线程)的模型在高并发下性能会更好...比如nodejs...
因为高并发下..多进程(线程)模型会使CPU的计算能力大部分浪费在其进程(线程)切换上...

$_SERVER 变量可能会有影响 然后重写规则需要修改 别的 基本上差不多

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!