: This article mainly introduces the wampserver installation of pthreads multi-thread extension tutorial. if you are interested in the PHP Tutorial, refer to it. Multithreading is required in the project. I found that php can support multithreading after pthreads is installed, so I went to google. The installation content is as follows.
Select the corresponding pthreads version based on PHP ts \ ETS
Download pthreads: http://windows.php.net/downloads/pecl/releases/pthreads/2.0.9/
This php example is 5.4.17to download the php_pthreads-0.1.0-5.4-ts-vc9-x86.zip file package. 0.1.0 indicates the current pthreads version and 5.4 indicates the php version. (please note that if I fail many times, this is the bad version ), ts is the ts and ts versions corresponding to php. vs9 indicates that it was compiled by Visual Studio 2008 compiler, the last x86 version represents a 32-bit version (64-bit systems can also be used, because there is no 64-bit system ).
Install pthreads extension
After the file is downloaded, only two files are needed: pthreadVC2.dll and php_pthreads.dll;
1. modify the php. ini file and add extension = php_pthreads.dll. (you need to note that php. ini has one copy under apache and php. we recommend that you add it to it)
2. put the pthreadvc2.dllfile to the same directory of php.exe and put php_pthreads.dll to the extension directory.
In addition, copy pthreadVC2.dll to the apache/bin directory.
3. restart wampserver.
Test pthreads extension
arg = $arg; } public function run(){ if($this->arg){ printf("Hello %s\n", $this->arg); } } } $thread = new AsyncOperation("World"); if($thread->start()) $thread->join(); ?>
Run the above code to get "HelloWorld". it indicates that the pthreads extension is successfully installed!
The above introduces the wampserver installation of pthreads multi-thread extension tutorial, including some content, hope to be helpful to friends interested in PHP Tutorial.