PHP之路——pthreads扩展
2017-03-09 10:48
211 查看
扩展使用要求:php5.3或以上,且为线程安全版本
下载pthreads扩展包是注意编译器版本,phpinfo()里面的Compiler项
pthreads扩展下载:http://windows.php.net/downloads/pecl/releases/pthreads/
pthreads函数文档:http://www.php.net/manual/zh/book.pthreads.php
1.下载pthreads扩展包,获取里面的php_pthreads.dll和pthreadVC2.dll
复制php_pthreads.dll 到目录 php\ext\ 下面
复制pthreadVC2.dll 到目录php\ 下面
复制pthreadVC2.dll 到目录apache\bin\ 下面
打开php配置文件php.ini。在后面加上extension=php_pthreads.dll
2.重启apache
3.测试扩展是否打开
运行以上代码出现 Hello World,说明pthreads扩展安装成功!
注意只能在cli模式下运行
下载pthreads扩展包是注意编译器版本,phpinfo()里面的Compiler项
pthreads扩展下载:http://windows.php.net/downloads/pecl/releases/pthreads/
pthreads函数文档:http://www.php.net/manual/zh/book.pthreads.php
1.下载pthreads扩展包,获取里面的php_pthreads.dll和pthreadVC2.dll
复制php_pthreads.dll 到目录 php\ext\ 下面
复制pthreadVC2.dll 到目录php\ 下面
复制pthreadVC2.dll 到目录apache\bin\ 下面
打开php配置文件php.ini。在后面加上extension=php_pthreads.dll
2.重启apache
3.测试扩展是否打开
<?php class AsyncOperation extends \Thread { public function __construct($arg){ $this->arg = $arg; } public function run(){ if($this->arg){ printf("Hello %s\n", $this->arg); } } } $thread = new AsyncOperation("World"); if($thread->start()) $thread->join(); ?>
运行以上代码出现 Hello World,说明pthreads扩展安装成功!
注意只能在cli模式下运行
相关文章推荐
- PHP 多线程扩展(正儿八经的线程)pthreads安装
- php pthreads 多线程扩展的使用:一个较为稳定例子。
- php下pthreads扩展安装
- wamp安装pthreads扩展(PHP多线程)
- iis7.0安装php的pthreads扩展
- 扩展编程PHP自学之路--------PHP数据库编程
- PHP之路——Xdebug扩展
- php 多线程 pthreads扩展
- windows下安装php真正的多线程扩展pthreads教程
- PHP之路——MongoDB扩展
- PHP 多线程扩展 pthreads
- wamp安装pthreads扩展(PHP多线程)
- windows下安装php真正的多线程扩展pthreads教程
- windows下xampp安装PHP的pthreads多线程扩展
- PHP的pthreads扩展
- php pthreads 多线程扩展的使用:一个较为稳定例子。
- wamp安装pthreads扩展(PHP多线程) windows
- wamp安装pthreads扩展(PHP多线程)
- PHP多线程扩展pthreads示例
- 我的 PHP安装MongoDB扩展-Windows Wamp版 之路