“尝试使用PHP pthreads时,在...中找不到致命错误类'Thread'

I’m working on a project for my graduation and I need to enable pthreads in PHP because I need multithreading. I used a tutorial, but I get this error: Fatal error class 'Thread' not found in….

I searched the web for help on how to enable pthreads, but nothing helped. I’m using PHP version 5.4.7.

There is no 'threading' in PHP. You can fork a new 'process' using pctnl_fork(), however there is no built in shared memory between the two processes (youll have to implement shmop() or a socket server setup to communicate between processes). Also, pcntl_* is only usable on linux setups, not windows.

A user suffering the same error has posted the solution on github: https://github.com/krakjoe/pthreads/issues/154

The short of it is you have to add pthreadVC2.dll to Apache configuration ... I wasn't aware of this, I don't use Windows ...

That should get you sorted ...

the dlls should be compatible with your php version

check this answer pthread not working in php