[英]Running php multithreaded(using pthread) script from wamp-server localhost
I am trying to execute a multithreaded php script using php pthreads on Windows. 我正在尝试在Windows上使用php pthreads执行多线程php脚本。
I have followed the following links, and placed the following files 我已遵循以下链接,并放置了以下文件
pthreadVC2.dll pthreadVC2.dll
php_pthreads.dll php_pthreads.dll
as suggested by the following links 如以下链接所示
http://emrahmehmedov.blogspot.com/2013/03/php-and-multi-thread-on-windows.html http://emrahmehmedov.blogspot.com/2013/03/php-and-multi-thread-on-windows.html
https://github.com/krakjoe/pthreads https://github.com/krakjoe/pthreads
Also I have made changes to the php.ini file, as suggested. 另外,我还建议对php.ini文件进行更改。
The problem is : 问题是 :
The script is executed well when run using 'php' command using windows commandline, but when I try to run it from wamp-server localhost(wamp/www/) from the browser , it gives error "Thread Class not found". 在Windows命令行中使用“ php”命令运行该脚本时,执行效果很好,但是当我尝试从浏览器的wamp-server localhost(wamp / www /)运行该脚本时,它给出了错误“找不到线程类”。 Here is my testing script:
这是我的测试脚本:
<?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();
?>
Any Idea Why is this happening?? 知道为什么会这样吗? Any Solution for this??
任何解决方案? as I have to run the script from the wamp-server localhost through browser.
因为我必须通过浏览器从wamp-server本地主机运行脚本。 Please Help.
请帮忙。
I have also enable php_pthreads extension form wamp GUI. 我还启用了php_pthreads扩展表单wamp GUI。
Please Help I have been struck here for 2 weeks. 请帮助我被打了两个星期。
I tried everything to run pthread in wamp and no luck. 我尝试了一切以在沼泽中运行pthread并没有运气。 I gave up and downloaded xampp and it took few minutes to run pthread
我放弃并下载了xampp,花了几分钟运行pthread
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.