dton37910 2016-03-09 14:56
浏览 1045
已采纳

使用--enable-maintainer-zts编译PHP时的缺点或副作用(使用php pthread)

I have a web application and is running fine with PHP 5.5.5 on a production environment.

On the same server now I need to run some PHP scripts that make use of php pthread (v. 2.0.10)

Is it safe to rebuild php with --enable-maintainer-zts (to allow use of pthreads) and use the same executable both for the web application and the CLI scripts that use php-pthread ?

Or should I make two builds of PHP: php, php-zts and use the former for the web app and the latter for the CLI scripts ?

As --enable-maintainer-zts is not enabled by default I assume it have some drawbacks or worse (as I have read here https://github.com/travis-ci/travis-ci/issues/985) may introduce misbehaviours (bugs).

The web stack is nginx + php-fpm + mySql on Mac OS X 10.9.5.

I want it to be clear: phtread will not be used by the web application scripts. Only by the CLI scripts.

  • 写回答

1条回答 默认 最新

  • dtmjqyfz21793 2016-03-14 22:41
    关注

    From http://www.phpinternalsbook.com/build_system/building_php.html

    (emphasis mine)

    --enable-debug enables debug mode

    [...]

    --enable-maintainer-zts enables thread-safety.

    [...]

    you should not use either of these options if you want to perform performance benchmarks for your code, as both can cause significant and asymmetrical slowdowns.

    --enable-maintainer-zts seem not harmful but affects performances. So it's definitely not advisable in a production environment.

    A separate build of PHP with --enable-maintainer-zts in order to use php pthread in CLI scripts is the appropriate way to go.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题