guanpengchn / guanpengchn.github.io

:memo: code on DEV branch, blogs on ISSUES
https://guanpengchn.github.io
18 stars 8 forks source link

xampp install pthreads for php #5

Open guanpengchn opened 6 years ago

guanpengchn commented 6 years ago

1. Check the runtime enviroment

D:\xampp\php>php -v
PHP 5.6.34 (cli) (built: Jul 18 2013 10:56:37)

The php of xampp is 32-bit by default.

1-version

It determines the location of "pthreadVC2.dll".

2. Download the file

File url : http://windows.php.net/downloads/pecl/releases/pthreads/

Download php_pthreads-2.0.9-5.6-ts-vc11-x86.zip according to the above version.

3. Install

4. Test

Official test code:

<?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();
?>

If it has error, you can use the following command to check it out.

D:\xampp\php>php -m

You can make sure if the pthreads module have been loaded.

heelghevariya commented 1 year ago

Whenever I put "LoadFile D:/xampp/php/pthreadVC2.dll" to "httpd.conf". Apache don't start

msmc98 commented 5 months ago

this was probably cause you had no D:/ disk, change to C:/ maybe, or the disk that you were using