Running php multithreaded(using pthread) script from wamp-server localhost
Posted by: afi.alvi (139.190.107.---)
Date: March 24, 2014 10:00PM

I am trying to execute a multithreaded php script using php pthreads on Windows.

I have followed the following links, and placed the following files

pthreadVC2.dll

php_pthreads.dll

as suggested by the following links

[emrahmehmedov.blogspot.com]

[github.com]

Also I have made changes to the php.ini file, as suggested.

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". 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"winking smiley;
$thread2 = new AsyncOperation("Thread 2"winking smiley;
$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. Please Help.

I have also enable php_pthreads extension form wamp GUI.

Please Help I have been struck here for 2 weeks.

Options: ReplyQuote


Sorry, only registered users may post in this forum.