【问题标题】:How to enable pthreads in PHP 5.6.13 at CentOS 6.7?如何在 CentOS 6.7 的 PHP 5.6.13 中启用 pthreads?
【发布时间】:2015-09-17 01:16:10
【问题描述】:

我通过 IUS 存储库在 CentOS 6.7 上安装了 PHP 5.6.13。这是php -v 命令的输出:

# php -v
PHP 5.6.13 (cli) (built: Sep  3 2015 11:54:03)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies
    with Xdebug v2.3.3, Copyright (c) 2002-2015, by Derick Rethans

为了安装和启用pthreads,我按照以下步骤操作:

  1. 搜索合适的包:

    # yum search pthreads
    ================================= N/S Matched: pthreads ===============================
    mingw32-winpthreads-static.noarch : Static version of the MinGW Windows pthreads library
    mingw64-winpthreads-static.noarch : Static version of the MinGW Windows pthreads library
    php55u-pecl-pthreads-debuginfo.x86_64 : Debug information for package php55u-pecl-pthreads
    php56u-pecl-pthreads-debuginfo.x86_64 : Debug information for package php56u-pecl-pthreads
    mingw32-winpthreads.noarch : MinGW pthread library for the win32 target
    mingw64-winpthreads.noarch : MinGW pthread library for the win64 target
    openblas-threads.i686 : An optimized BLAS library based on GotoBLAS2, pthreads version
    openblas-threads.x86_64 : An optimized BLAS library based on GotoBLAS2, pthreads version
    php55u-pecl-pthreads.x86_64 : Threading API
    php56u-pecl-pthreads.x86_64 : Threading API
    
  2. 安装包:

    #yum install php56u-pecl-pthreads.x86_64
    
    Resolving Dependencies
    --> Running transaction check
    ---> Package php56u-pecl-pthreads.x86_64 0:2.0.10-2.ius.el6 will be installed
    --> Finished Dependency Resolution
    
    Dependencies Resolved
    =======================================================================================================================================================================================================================================
     Package                                                         Arch                                              Version                                                        Repository                                      Size
    =======================================================================================================================================================================================================================================
    Installing:
     php56u-pecl-pthreads                                            x86_64                                            2.0.10-2.ius.el6                                               ius                                             71 k
    
    Transaction Summary
    =======================================================================================================================================================================================================================================
    Install       1 Package(s)
    
  3. 找到.so 所在的位置:

    #locate pthreads.so
    /usr/lib64/php-zts/modules/pthreads.so
    
  4. 通过尝试以下每一行在/etc/php.ini 启用:

    extension=pthreads.so
    extension=/usr/lib64/php-zts/modules/pthreads.so
    zend_extension=pthreads.so
    zend_extension=/usr/lib64/php-zts/modules/pthreads.so
    
  5. 重新启动 Apache 并查找模块

    # php -m | grep pthreads
    Failed loading /usr/lib64/php-zts/modules/pthreads.so:  /usr/lib64/php-zts/modules/pthreads.so: undefined symbol: core_globals_id
    

并且总是失败并显示上述消息。我做错了什么?

注意:我通过运行phpinfo() 注意到Thread Safety 已禁用,我是否需要启用此功能才能正确加载库?

【问题讨论】:

    标签: php pthreads


    【解决方案1】:

    由于某种原因,有两个不同的版本,您安装的一个会导致与您的 PHP 版本发生冲突。与用于构建 PHP 本身的编译选项相比,用于 pthreads.so 的编译选项不匹配。

    php56u-pecl-pthreads.x86_64 0:2.0.10-2.ius.el6

    您应该从相同的源/版本中删除和安装所有内容。 这是我唯一能想到的。

    编辑: 你可以试试这个...pthreads using php+zts rpms on centos

    【讨论】:

    • 你错了,同一个扩展有两个版本:php55u-pecl-pthreads.x86_64 用于 php5u(表示 PHP 5.5.x)和php56u-pecl-pthreads.x86_64 用于 php56u(PHP 5.6.x)。 x)安装的扩展是正确的,所以我在这里缺少一些东西我找不到它
    • 是的,你说得对,我说的是这个特定的数字 >0:2.0.10-2.ius.el6
    • 我没关注你,那个号码和PHP版本有什么问题?
    • 您的 PHP 版本是 PHP 5.6.13 (cli)(构建时间:2015 年 9 月 3 日 11:54:03) 但是构建的 PHP 与您的 不兼容pthreads 例如:REMI 的 PHP 并从 IUS 安装 pthreads,你会得到那个错误......这是一个极端的例子......
    • 这也不是问题,PHP 和扩展都是从同一个仓库 IUS 安装的:php56u-pecl-pthreads, php56u-common
    猜你喜欢
    • 2015-12-04
    • 2016-04-14
    • 2016-03-24
    • 1970-01-01
    • 2013-08-14
    • 1970-01-01
    • 2017-07-03
    • 2016-05-03
    • 2015-10-31
    相关资源
    最近更新 更多