duanouyong4228 2015-09-17 01:16
浏览 139
已采纳

如何在CentOS 6.7的PHP 5.6.13中启用pthreads?

I have PHP 5.6.13 installed at CentOS 6.7 through IUS repositories. This is the output of php -v command:

# 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

For install and enable pthreads I have follow this steps:

  1. Search the proper packages:

    # 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. Install the package:

    #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. Locate where the .so did go:

    #locate pthreads.so
    /usr/lib64/php-zts/modules/pthreads.so
    
  4. Enable at /etc/php.ini by trying each of the following lines:

    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. Restarted Apache and find for the module

    # 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
    

And all the time it fails with the message above. What I am doing wrong?

Note: I have notice by running phpinfo() that Thread Safety is disabled, do I need this enabled in order to properly load the library?

  • 写回答

1条回答 默认 最新

  • duangou1953 2015-09-17 01:54
    关注

    For some reason there is two different Versions, the one you installed which cause a conflict with your PHP version. Mismatched compile options used with pthreads.so compared with those used to build PHP itself.

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

    You should remove and install everything from the same source/version. That's only thing i could think of.

    EDIT: you could try this... pthreads using php+zts rpms on centos

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

报告相同问题?

悬赏问题

  • ¥15 metadata提取的PDF元数据,如何转换为一个Excel
  • ¥15 关于arduino编程toCharArray()函数的使用
  • ¥100 vc++混合CEF采用CLR方式编译报错
  • ¥15 coze 的插件输入飞书多维表格 app_token 后一直显示错误,如何解决?
  • ¥15 vite+vue3+plyr播放本地public文件夹下视频无法加载
  • ¥15 c#逐行读取txt文本,但是每一行里面数据之间空格数量不同
  • ¥50 如何openEuler 22.03上安装配置drbd
  • ¥20 ING91680C BLE5.3 芯片怎么实现串口收发数据
  • ¥15 无线连接树莓派,无法执行update,如何解决?(相关搜索:软件下载)
  • ¥15 Windows11, backspace, enter, space键失灵