Switch apache to nginx. Is the php programming model the same?

Source: Internet
Author: User
I heard that nginx does not need multiple processes. Isn't multiple requests using the same process not interfering? Does php code need to be rewritten? I heard that nginx does not need multiple processes. Isn't multiple requests using the same process not interfering?

Does php code need to be rewritten?

Reply content:

I heard that nginx does not need multiple processes. Isn't multiple requests using the same process not interfering?

Does php code need to be rewritten?

No need at all. It has nothing to do with php. php is a scripting language. You have a virtual machine to process these things. You don't need to worry about the platform on which to run them.

Some variables, such as _ SERVER [PHP_SELF], are related to apache or nginx.

With PHP, you only need to pay attention to the PHP interpreter. No matter which web server is used, you need to call the interpreter to execute the script.

Not only will it not interfere with... On the contrary, this single-process (thread) model will provide better performance in high concurrency... for example, nodejs...
Because of the high concurrency... the multi-process (thread) model will waste most of the CPU's computing power on its process (thread) switching...

The $ _ SERVER variable may have an impact, and then the rewrite rule needs to be modified.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.