2016-09-29 124 views
0

嗨我试图在php中实现线程。到目前为止,我读过的所有东西我都知道pthreads库可以用于这个目的。php_pthreads.dll - 指定的模块找不到。?

我已经通过下面的PHP安装指南了:

http://docs.php.net/manual/en/pthreads.installation.php

下载并行线程Windows安装拉链后,我解压缩到相应位置就&放在以下文件:

移动

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. 

配置php \ php.ini并添加

extension=php_pthreads.dll 

但我正在逐渐在服务器启动时的错误,如下所示:

PHP Warning: PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext\php_pthreads.dll' - The specified module could not be found. 

in Unknown on line 0 

我无法检测到的是上面的文件php_pthreads.dll的问题@given位置,有什么可以去错误。

xampp的PHP版本:5.6.15,Pthreads lib版本:3.1.0这两个软件都是用于x86架构的。

我做出改变的埼玉县以下的建议,改变了并行线程的版本从3.1.0到2.0.0我得到了如下新的警告:

PHP Warning: PHP Startup: pthreads: Unable to initialize module 
Module compiled with module API=20100525 
PHP compiled with module API=20131226 
These options need to match 
in Unknown on line 0 

如何我匹配这些编译版本的API我有PHP扩展内部版本号为20131226,但是如何在下载pthread二进制安装zip时决定这个数字?

+0

我会建议你,如果可能的话,通过编译源代码来构建'pthreads'。或者下载与您的PHP版本匹配的pthreads版本。 – Ikari

+0

如何在下载时检查pthreads的编译版本我知道php编译版本? – pcj

回答

2

只有在使用CLI SAPI时才能加载pthreads模块。

它只在CLI SAPI只可用。

此外,pthreads v3仅适用于PHP7,由于您使用的是PHP 5.6,因此您需要使用pthreads v2

它只能在cli sapi下使用,因为在apache下产生多个线程可能被证明是bug。

所以,问题是: *您正试图加载pthreads在另一个SAPI下,而不是CLI。 *您需要使用pthreadsv2而不是pthreadsv3


注意:如果你会使用pthreadsv2你可以最有可能加载了Apache的SAPI下并行线程。但仍然不推荐。我们强烈建议使用其他方法。

+0

请看看@编辑的问题 – pcj

相关问题