PHP pthreads: Fatal error: Class 'Thread' not found

前端 未结 6 1515
小蘑菇
小蘑菇 2020-12-06 05:28

I use php5.5 on my webserver. Now I want to use pthreads. Here\'s my php config: http://dd19010.kasserver.com/infophp.php55

After implementing this code.....

6条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-06 05:46

    Hi I encountered this problem and managed to solve it.

    First, consider the VC version of your PHP and the VC version of extension. In mine I attached the extension pthreads.dll with version VC14 from http://windows.php.net/downloads/pecl/releases/pthreads/ but my PHP VC version is VC11. Look for the lower version to match with the VC version of your PHP.

    Second, maybe you missed the step #3 at PHP page. It states that you need to copy the pthreadVC2.dll to different folder. Here's the full instruction.

    1. Find out what is your 'PHP Extension Build' version by using phpinfo(). You can use this - http://localhost/?phpinfo=1

    2. Download the pthreads that matches your php version (32 bit or 64 bit) and php extension build (currently used VC11). Use this link for download - http://windows.php.net/downloads/pecl/releases/pthreads/

    3. Extract the zip - Move php_pthreads.dll to the 'bin\php\ext\' directory. Move pthreadVC2.dll to the 'bin\php\' directory. Move pthreadVC2.dll to the 'bin\apache\bin' directory. Move pthreadVC2.dll to the 'C:\windows\system32' directory.

    4. Open php\php.ini and add extension=php_pthreads.dll

    Reference: https://secure.php.net/manual/en/pthreads.installation.php

提交回复
热议问题