“Fatal error class 'Thread' not found in…” when trying to use PHP pthreads
11,897
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 ...
Author by
Antreas Apostolou
Updated on June 05, 2022Comments
-
Antreas Apostolou almost 2 years
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.
-
Antreas Apostolou over 10 yearsThen whats's the usage of pthreads???In php there is a whole documentation talking about them...php.net/manual/en/book.pthreads.php Is your suggestion about using pctnl_fork() tested?(some example)?
-
Antreas Apostolou over 10 yearsi have implemented a search engine system with multiple online users, and my teacher now wants every time the search button isset to start a new proccess.So if the button clicked by different users we are talking about mulriple threads...i dont know how excactly i this coz as you said there is no threads in php..im to complicated..
-
kwolfe over 10 yearsWhoa. This is not necessary, at all. A new process is launched each time someone opens the site. Each session (browser) is completely separate and will not occupy the same memory space as other requests that happen to come in at the same time. Just write the script out to work on what you think would be one mcahine and it will work on all.