About PHP Thread-safe Mode (thread Safety) "Go"

Source: Internet
Author: User
Tags fpm

PHP itself is not thread-support, but it is installed, when it comes to a thread-safe problem, Windows provides two kinds of installation packages, Linux under the compiler installation provides –enable-maintainer-zts this option.

Many people think it is a good thing to see "safety", but it is not. Since PHP has no threads, what does this thread security refer to? It's about how it works. Here are just a few of the two popular PHP operating modes (LNMP and Lnamp) that are prevalent under Linux systems. If it is a LNMP environment, that is, PHP is running in PHP-FPM mode, then the problem of thread safety is not involved, because PHP-FPM is run in a multi-process way. If you are running in Lnamp or lamp mode (mod_php), then you should first understand the next Apache MPM, in short, Apache supports multi-threaded operation (Worker), and also supports running in multiple processes (prefork). In general, the majority of Apache under Linux is running in prefork mode, which is due to stability considerations. So, in summary, LNMP without thread safety, Apache under the consideration of stability, it is recommended to run in a multi-process mode (prefork), so it does not require thread safety. Finally, PHP is a thread-safe installation that consumes more CPUs than non-thread-safe, and may add bugs or instability, which is the point, or PHP doesn't have to set this option. Original address: http://www.myhack58.com/Article/60/63/2015/60894.htm

About PHP Thread-safe Mode (thread Safety) "Go"

Related Article

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.