duanmie9682 2014-04-11 18:05 采纳率: 100%
浏览 125
已采纳

如何在phpfarm php安装上安装pthreads

Documenting my struggles to help others and hopefully get some feedback on how I could have done it better.

The command pecl install pthreads fails due to the php installed on my ubuntu 13.04 box not having zts configured.

Options:

1) The ubuntu respository does not have a php package with zts enabled. As of this post, ubuntu only has php 5.4.9 in it's repository (Released: 22 Nov 2012). It is possible to compile a php version from source - which I eventually did (see below), but..

2) I .. ALSO .. wanted to use phpfarm for the ability to run different versions of PHP on my local setup. On github, there is Christian Weiske's original contribution here (phpfarm) and a fork that he has contributed to, by François Poirotte - also called phpfarm. Francois' fork has a few more options to configure ('post-install customization') but I was not able to make that work with a PECL extension. I'm curious to know if misunderstood how to do that, because it looks to me that it just simply does not take PECL commands.

3). Prior to recompiling php from source, I loaded phpfarm (tried both versions), enabled php-fpm (FastCGI) and was able to get my apache2 server to use a phpfarm version (5.5.10) which showed up in a phpinfo() output. But the php-cli always showed the original php version (5.4.9) in the cli (run: php -v). Running (run: php -i | grep php.ini) showed /etc/php5/cli but I had previously removed php5 and aptitude show php5 returned a state of 'not installed.' I even renamed the /etc/php5 directory to see if I could force the system to use the phpfarm php version. Obviously, this is incorrect thinking and I went on to simply compile php 5.6 from source. But, is there something more to do to get a phpfarm php to be used in the cli? I read that the cli loads it's configuration file on a per command basis, unlike the apache2. If I could have run the 5.5.10 version (configured with zts) then I could have then done pecl install pthreads and then re-complied the phpfarm 5.5.10 version with pthreads enabled. Although it appears I will be able to run various versions of php in the apache server, will I ever be able to switch-phpfarm to another version and see it working in the php-cli? Also, I was uncertain on where I could have loaded a pthreads file for the phpfarm compile process to find and use it; could I have done it that way?

4) This stackoverflow post, essentially posted by Joe Watkins - the developer of pThreads is a perfect how-to on getting pThreads installed on a Ubuntu system that has had php configured with zts (Zend Thread Safety). (Thanks Joe!)

A nice tutorial on using phpfarm configured with fast-cgi and the apache server to help run websites under different php configurations.

So what gives with php, php-cli and the phpfarm?

  • 写回答

1条回答 默认 最新

  • duanhuizhe6767 2014-04-11 18:53
    关注

    I'm not sure about phpfarm, but do know of another solution ...

    Multi

    A tool for maintaining multiple installations of PHP in multiple configurations

    https://github.com/datingvip/multi

    This is a bit more user orientated, will allow you to build many configurations and versions of php, any tagged release of php, and any patched version from any fork of php-src.

    In addition, because I wrote it, it will install pthreads for you.

    git clone https://github.com/datingvip/multi
    cd multi
    VERSION=5.5.10 DBG=no-debug ZTS=zts ./php.multi
    

    The above commands will yield an installation of PHP (in one suitable configuration, of one version) in /opt/php.

    Look at php.defaults for configuration options and adjust before building

    Should configuration fail on, for example, something related to a library like libxml2, it will usually be the case that

    sudo apt-get install library-dev
    

    Where library is replaced with the name of the library holding up the build, will fix the problem for you. If it does not, a quick google should get you going again.

    Once the build is complete

    source /path/to/multi/php.env 5.5.10
    

    Note: multi will always install pthreads for any zts version automatically

    I hope that gets you somewhere ...

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

报告相同问题?

悬赏问题

  • ¥15 matlab数字图像处理频率域滤波
  • ¥15 ELGamal和paillier计算效率谁快?
  • ¥15 file converter 转换格式失败 报错 Error marking filters as finished,如何解决?
  • ¥15 ubuntu系统下挂载磁盘上执行./提示权限不够
  • ¥15 Arcgis相交分析无法绘制一个或多个图形
  • ¥15 关于#r语言#的问题:差异分析前数据准备,报错Error in data[, sampleName1] : subscript out of bounds请问怎么解决呀以下是全部代码:
  • ¥15 seatunnel-web使用SQL组件时候后台报错,无法找到表格
  • ¥15 fpga自动售货机数码管(相关搜索:数字时钟)
  • ¥15 用前端向数据库插入数据,通过debug发现数据能走到后端,但是放行之后就会提示错误
  • ¥30 3天&7天&&15天&销量如何统计同一行