PHP Pthreads dllファイルをhttp://windows.php.net/downloads/pecl/releases/pthreads/からダウンロードし、以下のようにphp.iniで有効にしました。
extension=pthreadVC2.dll
extension=php_pthreads.dll
以下のサンプルコードを使用しました。
<?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();
コードを実行すると、次のエラーが発生します。
致命的なエラー:クラス'スレッド'が2行目のC:\ htdocs \ threads \ AsyncOperation.phpに見つかりませんコールスタック:0.0008 333464 1. {main}()C:\ htdocs \ threads \ AsyncOperation.php:0