Wampserver installation of pthreads multi-thread extension tutorial

Source: Internet
Author: User
Tags php example
: 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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.