PHP是线程安全的吗? [英] Is PHP thread-safe?

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

问题描述

  • Linux(从5.2版开始)在Linux/UNIX上是线程安全的吗?
  • 是否可以将其与Apache Worker-MPM或Event-MPM一起使用?
  • Is PHP (as of 5.2) thread-safe on Linux/UNIX?
  • Would it be possible to use it with Apache Worker-MPM or Event-MPM?

我到目前为止收集的事实尚无定论:

The facts I gathered so far are inconclusive:

  • 大多数发行版中包含的默认二进制文件均已禁用ZTS,因此我知道我必须重新编译它们.
  • 从理论上讲,启用ZTS的Zend Engine(核心PHP)是线程安全的.
  • 有人说某些模块可能不是线程安全的,但我还没有找到任何存在或不存在的模块列表.
  • PHP FAQ 的说明几乎相同如上所述.
  • Default binaries included in most distributions have ZTS disabled, so I'm aware, that I'd have to recompile them.
  • In theory Zend Engine (core PHP) with ZTS enabled is thread-safe.
  • It's said that some modules might not be thread-safe, but I haven't found any list of modules that are or that are not.
  • PHP FAQ states pretty much same as above.

您的经历是什么?

这不仅与分段错误(Windows命名法中的访问冲突")有关. 线程安全还有很多.

It's not only about segmentation faults ("access violations" in Windows nomenclature). There is a lot more to thread safety.

推荐答案

我知道gettext和 set_locale 不是线程安全的. PHP不应与线程MPM一起使用.

I know gettext and set_locale is not threadsafe. PHP should not be used with a threaded MPM.

PHP不是线程-安全了.
正在运行未运行PHP的.

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

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