博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
真正的PHP多线程(绝非fork或者用http再开进程)
阅读量:7120 次
发布时间:2019-06-28

本文共 1201 字,大约阅读时间需要 4 分钟。

转载:http://blog.csdn.net/leinchu/article/details/8012640

我写了一个扩展打算放到pecl,但是,进过交流发现有人已经做了两个php的多线程扩展

1、

2、

 

刚才成功的编译后了第二个(一个似乎不是官方的标准扩展写法、估计有点儿麻烦,而且第一个是2年前的东西了),迫不及待的写下这篇文章,介绍怎么安装:

#如果你的autoconfig版本高于2.59,则只能安装php5.4#否则你只可以安装5.3.17。如果知道你的autoconf的版本——如果你已经安装了php.5.4那么,你就安装照5.4的安装;如果装了5.3就装5.3#5.4wget http://www.php.net/get/php-5.4.7.tar.gz/from/cn.php.net/mirrortar zxvf php-5.4.7.tar.gzcd php-5.4.7/ext#5.3wget http://www.php.net/get/php-5.3.17.tar.gz/from/cn.php.net/mirrortar -xf php-5.3.17.tar.gzcd php-5.3.17/ext#下面装pthreadswget https://github.com/krakjoe/pthreads/tarball/master -O pthreads.tar.gztar -xf pthreads.tar.gzmv krakjoe-pthreads* pthreadscd .././buildconf --force./configure --enable-maintainer-zts --enable-pthreads --prefix=/usr/local/php-threads#其它参数自行配置,这里只是必须的参数makemake install

源码包里面有例子,像这样执行:

/usr/local/php-threads/bin/php AdvancedSynchronization.php

Process: runningScopeTest: 140703850592000 runningScopeTest2: 140703839512320 runningScopeTest2: 140703839512320 working ...ScopeTest2: 140703839512320 notified: 1Process: notifying 140703839512320: 1ScopeTest: 140703850592000 notified: 1Process: notifying 140703850592000: 1

通过apache执行的还没有试过,因为我不想破坏现有的php环境,而且我也不打算在非cli模式下执行。

你可能感兴趣的文章
微软正式发布 Azure IoT Central
查看>>
七牛李倩:⼯程效率如何为研发赋能
查看>>
从“被动挖光缆”到“主动剪网线”,蚂蚁金服异地多活的微服务体系
查看>>
PhpStorm2016.3激活
查看>>
Docker4Dev #7 新瓶装老酒 – 使用 Windows Container运行ASP.NET MVC 2 + SQLExpress 应用
查看>>
Microsoft Flow发布GA版本
查看>>
Python 赋值的一般含义是引用
查看>>
magento2 在香港用paypal
查看>>
img/background/iconfont---谁最适合你?
查看>>
我的iOS程序生涯的起点
查看>>
程序员的工匠精神
查看>>
【underscore.js 源码解读】for ... in 存在的浏览器兼容问题你造吗
查看>>
Sass 与 Compass 实战经验总结
查看>>
微信公众号开发小记——3.接入三方登录
查看>>
个推获7亿元C轮募资,SDK接入超80亿
查看>>
如何10分钟让APP实现实时互动?
查看>>
Consul入门01 - 安装Consul
查看>>
css 不规整元素的宽高等比例
查看>>
let vs const
查看>>
Swift里你可能不知道的事儿(2)——处理对象reference cycle的三种方式
查看>>