[英]Running php multithreaded(using pthread) script from wamp-server localhost
我正在嘗試在Windows上使用php pthreads執行多線程php腳本。
我已遵循以下鏈接,並放置了以下文件
pthreadVC2.dll
php_pthreads.dll
如以下鏈接所示
http://emrahmehmedov.blogspot.com/2013/03/php-and-multi-thread-on-windows.html
https://github.com/krakjoe/pthreads
另外,我還建議對php.ini文件進行更改。
問題是 :
在Windows命令行中使用“ php”命令運行該腳本時,執行效果很好,但是當我嘗試從瀏覽器的wamp-server localhost(wamp / www /)運行該腳本時,它給出了錯誤“找不到線程類”。 這是我的測試腳本:
<?php
class AsyncOperation extends Thread {
public function __construct($arg){
$this->arg = $arg;
}
public function run(){
if($this->arg){
for($i = 0; $i < 5; $i++) {
echo "-> " . $this->arg . "\n";
sleep(1);
}
}
}
}
flush();
$thread = new AsyncOperation("Thread 1");
$thread2 = new AsyncOperation("Thread 2");
$thread->start();
$thread2->start();
$thread->join();
$thread2->join();
?>
知道為什么會這樣嗎? 任何解決方案? 因為我必須通過瀏覽器從wamp-server本地主機運行腳本。 請幫忙。
我還啟用了php_pthreads擴展表單wamp GUI。
請幫助我被打了兩個星期。
我嘗試了一切以在沼澤中運行pthread並沒有運氣。 我放棄並下載了xampp,花了幾分鍾運行pthread
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.