Windows的PHP线程安全和非线程安全 [英] PHP Thread Safe and Non-Thread Safe for Windows

查看:82
本文介绍了Windows的PHP线程安全和非线程安全的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在下载Windows的PHP.我在网站上有2个选择.

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

  1. PHP线程安全
  2. PHP非线程安全

请回答以下问题:

  1. 两者之间有什么区别?什么是 优势和劣势?
  2. 我正在开发一个流量大的电子商务网站,推荐哪个,为什么?
  1. What is the difference between the two? What are the advantages and disadvantages over one another?
  2. I am developing an e-commerce website which will have heavy traffic, which one is more recommended and why?

推荐答案

来自PHP文档:

线程安全性意味着二进制文件可以在多线程Web服务器上下文中工作,例如Windows上的Apache 2.线程安全的工作原理是在每个线程中创建一个本地存储副本,以使数据不会与另一个线程冲突.

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.

那我该怎么选择?如果选择将PHP作为CGI二进制文件运行,则不需要线程安全,因为在每次请求时都会调用二进制文件.对于IIS5和IIS6等多线程Web服务器,应使用PHP的线程版本.

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.

所以这实际上取决于您要使用PHP的方式:

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

  • Apache + LoadModule:线程安全
  • Apache + FastCGI:非线程安全
  • IIS:线程安全
  • IIS + FastCGI:非线程安全
  • Apache + LoadModule: Thread Safe
  • Apache + FastCGI: Non-Thread Safe
  • IIS: Thread Safe
  • IIS + FastCGI: Non-Thread Safe

PHP手册具有很好的安装说明.

PHP manual has nice installation instructions.

运行带有FastCGI的PHP的AFAIR是更可取的方法,它执行速度更快,并且可以进行更细粒度的安全性配置.

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

这篇关于Windows的PHP线程安全和非线程安全的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆