Wampserver Installing Pthreads multithreaded Extensions Tutorial

Source: Internet
Author: User
Tags php class
The project needs to use multi-threading, found that PHP installed Pthreads can support multi-threading, so Google down. Probably the installation content is as follows.


Select the corresponding pthreads version according to PHP version ts\nts

Download pthreads: http://windows.php.net/downloads/pecl/releases/pthreads/2.0.9/


I PHP version is 5.4.17, so download the Php_pthreads-0.1.0-5.4-ts-vc9-x86.zip file package, where 0.1.0 is represented as the current pthreads version number, 5.4 is the PHP version number (this need to pay special attention, I have not succeeded is bad here), TS is to judge PHP corresponding TS, NTS version, VS9 represents the visual Studio compiler compiler compiled, The last x86 represents a 32-bit version (64-bit systems can also be used because there is no 64-bit at all).

Installing the pthreads Extension

When the file is downloaded, only 2 files are needed. pthreadVC2.dll and php_pthreads.dll ;

1, modify the php.ini file add Extension=php_pthreads.dll (here need to explain the next php.ini in Apache and PHP have a copy, suggestions are added)

2, put pthreadVC2.dll file to php.exe sibling directory, put php_pthreads.dll In the extensions directory .

Another copy of the PthreadVC2.dll is placed in the Apache/bin directory.

3, restart the 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 ())   


run the above code to get "HelloWorld", it means the installation pthreads expansion success!

The above describes the Wampserver installation pthreads multithreading extension Tutorial, including the aspects of the content, I hope that the PHP tutorial interested in a friend to help.

  • 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.