Wednesday, April 22, 2020

PHP + PThreads (Posix Thread) Installation & Configuration Example


Installation is quite straightforward, although a little more involved than the Simple Windows Installation instructions suggest:
  1. Download a thread safe version of PHP, e.g. php-5.6.38-Win32-VC11-x86.
    • extract the .ZIP file to your hard drive, e.g. C:\php.
  2. Download the matching version of pthreads, e.g php_pthreads-2.0.10-5.6-ts-vc11-x86.
    • extract pthreadVC2.dll into the PHP folder, e.g. C:\php.
    • extract php_pthreads.dll into the extensions folder, e.g. C:\php\ext.
  3. In the PHP folder, copy either php.ini-development or php.ini-production to php.ini.
  4. Edit php.ini and add the line extension=php_pthreads.dll at the end of the file.
At this point pthreads should be working. You can verify this by opening a command prompt in the PHP folder and executing php --ri pthreads:
Screenshot of result
Note that the PHP and pthreads versions I referenced above require you to install the Visual Studio 2012 (VC11) runtime to function.

Edit: For completeness, I downloaded what seem to be the exact versions of PHP and pthreads you are using (the primary difference being x64):
Following the steps above I received the same result (except the pthreads version is reported as 2.0.9 of course).

Reference :

Previous Post
Next Post

0 komentar: