PHP安裝pthreads多執行緒擴充套件教程[windows篇]
阿新 • • 發佈:2019-01-09
本人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位的版本。
2、修改Apache配置檔案httpd.conf 新增LoadFile "X:/PHP5/pthreadVC2.dll"
3、重啟Apache伺服器
執行以上程式碼得到“HelloWorld”,就說明安裝pthreads擴充套件成功!<?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(); ?>