【问题标题】:How to recompile php with ZTS enabled on ubuntu?如何在 ubuntu 上启用 ZTS 重新编译 php?
【发布时间】:2014-09-05 13:15:39
【问题描述】:

我想在 Ubuntu 上使用多线程 PHP,但是当我尝试安装包 pthread 时,我收到以下错误消息:

配置:错误:pthreads 需要 ZTS,请在启用 ZTS 的情况下重新编译 PHP。

【问题讨论】:

    标签: php ubuntu thread-safety


    【解决方案1】:
    HOW TO INSTALL IN LINUX SYSTEM'S:
    ------------------------------------
    
    1) Download PHP sources and Unpack PHP
    
    2) Download PEAR
         wget http://pear.php.net/go-pear.phar
         php go-pear.phar
    
    3) Download pthreads
    Get PECL extension (PECL is a repository for PHP Extensions)
    
    # pecl install pthread-0.4.4
    
    4) Unpack pthreads
    copy pthread-0.4.4  to  php/ext
    (for ./configure allow  add option --enable-pthreads)
    
    # mv build/php-src-master/ext/pthreads-master    build/php-src-master/ext/pthreads
    
    5)  Reconfigure sources
    # ./buildconf --force
    # ./configure --help | grep pthreads
    
    You should see the appropriate --enable-pthreads option listed as a result, if you do not, then
    
    # rm -rf aclocal.m4
    # rm -rf autom4te.cache/
    # ./buildconf --force
    
    6) Build PHP
    Compile PHP source code
    Add:
    # ./configure --enable-debug --enable-maintainer-zts --enable-pthreads
    
    7) Installing PHP
    # make
    # sudo make install
    
    8) Update php.ini
    Add in php.ini
    extension=pthreads.so
    Include_path = “/usr/local/lib/php”
    
    9) Check Modules
    php -m (check pthread loaded)
    
    10) Test Thread Class
    # php SimpleTest.php
    

    【讨论】:

    • Doing pecl install pthread-0.4.4 我得到错误:没有可用的版本包“pecl.php.net/pthread”安装失败你知道我做错了什么吗?
    【解决方案2】:

    我认为您可以使用此 PPA 存储库添加启用 ZTS 的 PHP5:

    https://launchpad.net/~ondrej/+archive/ubuntu/php5

    sudo add-apt-repository ppa:ondrej/php5
    
    sudo apt-get update
    
    sudo apt-get upgrade
    

    【讨论】:

      猜你喜欢
      • 2015-07-21
      • 1970-01-01
      • 2015-07-26
      • 2015-07-12
      • 1970-01-01
      • 2021-07-18
      • 2017-11-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多