Pages

Friday, February 19, 2016

Setting Up Multithreading in PHP

Multi-threading in PHP is a very useful feature to take advantage of multi-core processors that is common today. However, multi-threading is not enabled by default.

To set up multi-threading in PHP, follow the following steps.

1. Check the PHP Extension Build for the php version you are using:

 After you have set up your website, go to the link:

localhost:8080/?phpinfo=1

The port number depends on the port you have used, it may be default 80 or any other port number
Look for PHP Extension Build in that page. Check the VC number. For me, its VC11. VC stands for Visual C++, the compiler version that was used to build the version of PHP that you are using. It is interesting to note that PHP which is itself a programming language is built using C and C++. Thus, a compiler need to be used to compile C code.

2. Go to http://windows.php.net/downloads/pecl/releases/pthreads/:

Click on the link above and select and download the latest version of zip file that has the same VC number as that of php version that you are using. For VC11, its 2.0.9. I downloaded php_pthreads-2.0.9-5.6-ts-vc11-x64.zip as I am using a 64 bit computer.

3. Extract the zip.

Move php_pthreads.dll to the php\ext\ directory.
Move pthreadVC2.dll to the php\ directory.

4. Change php.ini file

Open php\php.ini and add

extension=php_pthreads.dll

5. Restart your web server



1 comment:

  1. Youtube.Com Videos - Videoodl.cc
    Youtube.Com Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. youtube to mp3?trackid=sp-006 Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos. Videos.

    ReplyDelete