php
windows
本人php版本是5.4.17的因此下载php_pthreads-0.1.0-5.4-ts-vc9-x86.zip文件包,其中0.1.0表示为当前pthreads版本号,5.4为php版本号,ts就是以前判断php对应的ts、nts版,vs9表明是Visual Studio 2008 compiler编译器编译的,最后的x86表明的是32位的版本。安全
将下载好的php_pthreads-0.1.0-5.4-ts-vc9-x86.zip文件包解压获得服务器
pthreadVC2.dll和php_pthreads.dll文件,把vc2文件放到php.exe同级目录,把php_pthreads.dll放到扩展目录下。测试
一、修改php.ini文件 添加extension=php_pthreads.dll
二、修改Apache配置文件httpd.conf 添加LoadFile "X:/PHP5/pthreadVC2.dll"
this
三、重启Apache服务器spa
<?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(); ?>
运行以上代码获得“HelloWorld”,就说明安装pthreads扩展成功!.net