PHP Thread Safe and Non-Thread Safe for Windows

前端 未结 3 498
一个人的身影
一个人的身影 2021-01-29 22:50

I am downloading PHP for Windows. I got 2 options on the website.

  1. PHP Thread Safe
  2. PHP Non-Thread Safe

Please answer the following questions

3条回答
  •  一个人的身影
    2021-01-29 23:14

    From PHP documentation:

    Thread Safety means that binary can work in a multithreaded webserver context, such as Apache 2 on Windows. Thread Safety works by creating a local storage copy in each thread, so that the data won't collide with another thread.

    So what do I choose? If you choose to run PHP as a CGI binary, then you won't need thread safety, because the binary is invoked at each request. For multithreaded webservers, such as IIS5 and IIS6, you should use the threaded version of PHP.

    So it really depends on the way that you want to use PHP:

    • Apache + LoadModule: Thread Safe
    • Apache + FastCGI: Non-Thread Safe
    • IIS: Thread Safe
    • IIS + FastCGI: Non-Thread Safe

    PHP manual has nice installation instructions.

    AFAIR running PHP with FastCGI is the preferable way, it performs faster and allows for more fine-grained security configuration.

提交回复
热议问题