PHP Pthreads latest version 3.1.6 (64bit) not inst

2019-03-04 08:56发布

问题:

I am trying to install latest pthreads extension 3.1.6 64bit for PHP.

As per the author advice of pthreads, on http://github.com/krakjoe/pthreads

I have placed the two dlls to the desired locations.

Add pthreadVC2.dll (included with the Windows releases) to the same directory as php.exe eg. C:\Apache24\php Add php_pthreads.dll to PHP extention folder eg. C:\Apache\php\ext

And also in Windows\system32 directory

And also added LoadFile in [Apache Http.confd][1]

And I have added added extension to my php.ini

php.ini

But Apache won't start and when I check the apache error.log, I have the below

[Tue Jun 28 11:38:31.184618 2016] [ssl:warn] [pid 8640:tid 352] AH01909: localhost:443:0 server certificate does NOT include an ID which matches the server name

[Tue Jun 28 11:38:31.215819 2016] [core:warn] [pid 8640:tid 352] AH00098: pid file C:/Apache24/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?

I have moved php_pthreads.dll extension to top of the extension list and to the bottom but no joy. It just won't start with this pthreads dll. But if I comment back ;extension=php_pthreads.dll , my Apache will restart but just not with this pthreads dll.

Is this a bug or am I doing something wrong?

Little info of my system setup Window 7 64 Bit, with Apache 2.4.x VC14

PHP info

  • System Windows NT NG10676 6.1 build 7601

  • (Windows 7 Enterprise Edition Service Pack 1) AMD64

  • Build Date Jun 21 2016 15:08:19

  • Compiler MSVC14 (Visual C++ 2015)

  • Architecture x64

  • Thread Safety enabled

Please note I have all VC compilers installed on my system 10, 11, 14 all 64 bit and installed 32 bit as well just in case.

Please note, I have tried all previous threads about pthreads installation and they don't help with my installation. I have tried every google page but they just don't work, any help would be appreciated. If PHP pthreads designer can shed some light on this version.

回答1:

Quote from README:

pthreads v3 is restricted to operating in CLI only: I have spent many years trying to explain that threads in a web server just don't make sense, after 1,111 commits to pthreads I have realised that, my advice is going unheeded.

So I'm promoting the advice to hard and fast fact: you can't use pthreads safely and sensibly anywhere but CLI.

Thanks for listening ;)

Quote from blog explaining change from v2

...

EJB's expressly prohibit the programmer from creating threads by specification, and modern Java doesn't even have a 1:1 model. Obviously, this is mostly because the environment may be migrated (moved within a cluster of servers), moving threads outside of it's managed pool is difficult to imagine. It goes further than prohibiting the creation of threads though, it prohibits the use of synchronization primitives, because what if a node is moved while you retain a lock - all hell breaks loose.

In Java generally, you are discouraged from manually creating threads in Servlets, for all the same reasons I have discouraged it for pthreads.

While it's true that not every environment will actually prohibit it, it runs as deep as can be; Everyone agrees that creating real (1:1) threads in a web response context is a bad idea.

...