pthreads icon indicating copy to clipboard operation
pthreads copied to clipboard

Fatal Error: Class Thread not found - no mater what I do

Open giyorasharaby opened this issue 8 years ago • 5 comments

Hi I get fatal error (“Class Thread not found”) and although I implemented the proper steps to add thread support to my XAMPP - I cannot resolve this. I did the following steps:

  1. I am using Windows 7 x64 os.

  2. Installed XAMPP. I run phpinfo() got this FTP snapshot: php

  3. I downloaded the file "http://windows.php.net/downloads/pecl/releases/pthreads/3.1.6/php_pthreads-3.1.6-7.0-ts-vc14-x64.zip" (notice the file name match the OS 64 bit version and it includes VC14 that match my FTP build). From the zip file I extracted the files pthreadVC2.dll and php_pthreads.dld and placed them in "c:\xampp\php" and "c:\xampp\php\etc" respectively.

  4. I added the line “extension=php_pthreads.dll” to c:\xampp\php\php.ini

After all this – I still get the error. Any help will be much appreciated Thanks Giyora

giyorasharaby avatar Feb 01 '18 12:02 giyorasharaby

pthreads 3.1.6 release on PECL is not compatible with PHP 7.1, only 7.0. Additionally pthreads is no longer supported anywhere except the CLI (as seen on the README.md file).

dktapps avatar Feb 01 '18 12:02 dktapps

Thanks for the quick reply. I installed php version 7.0.27 as sugested - got the the same error. Here is my new PHP profile (I am using the same php_pthreads-3.1.6-7.0-ts-vc14-x64.zip file: php

giyorasharaby avatar Feb 01 '18 20:02 giyorasharaby

As stated before, pthreads doesn't support any SAPI except CLI (command-line interface) now, you're using Apache 2.0 Handler.

dktapps avatar Feb 01 '18 20:02 dktapps

I see. Is there another library I can use to add thread support to my Windows XAMPP? If not, What PHP\XAMPP version do you suggest I should use that does support SAPI and threads? I am new to PHP world and all this incompatibility is real confusing...

giyorasharaby avatar Feb 01 '18 20:02 giyorasharaby

Threading extensions are not suitable for web server environments. If you'd like to use threading in PHP, then you should stick to the CLI instead. Check out this StackOverflow question for further information on using xampp's PHP from the command line.

tpunt avatar Feb 04 '18 10:02 tpunt