【问题标题】:PHP7 Startup: pthreads: Unable to initialize module pthreads in Windows 7PHP7 启动:pthreads:无法在 Windows 7 中初始化模块 pthreads
【发布时间】:2017-06-04 16:58:58
【问题描述】:

我在 Window 7 Enterprise 上成功安装了以下内容:

httpd-2.4.25-win64-VC14
php-7.1.1-Win32-VC14-x64 (Thread Safe (2017-Jan-18 21:06:35))
php_pthreads-3.1.6-7.0-ts-vc14-x64 from http://windows.php.net/downloads/pecl/releases/pthreads/3.1.6/

phpinfo 页面看起来不错,线程安全 = 已启用。

我按照php_pthreads-3.1.6-7.0-ts-vc14-x64 包的 README.md 文件中的所有说明进行操作。

但是,当我执行“php -m”时,我得到了这个错误:

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

Warning: PHP Startup: pthreads: Unable to initialize module
Module compiled with module API=20151012
PHP    compiled with module API=20160303
These options need to match
 in Unknown on line 0
[PHP Modules]
bcmath
calendar
Core
ctype
date

... 我之前在 PHP 5.4.33 中使用过线程,但我决定升级到 PHP7 以支持 tlsv1.1 和 tlsv1.2

【问题讨论】:

  • 我有完全相同的错误,但在 Windows 10 和 php 7.1.6 上

标签: multithreading php-7


【解决方案1】:

报错原因是pthread dll与安装的php版本不兼容。

根据github issue discussion最新发布的php_pthreads-3.1.6-7.0-ts-vc14-x64将不支持windows上的php 7.0或7.1,因为ZTS在这些版本上被破坏了。

因此,如果您在 Windows 上,并且想要使用 pthread.. 您必须降级到 PHP 5.6 或等待 PHP 7.2 和 php_pthreads 的下一个版本。

另一个选择是使用这个 php_pthreads 的 beta 版本: https://github.com/SirSnyder/pthreads/releases/tag/v3.1.7-beta.1

【讨论】:

    猜你喜欢
    • 2011-07-05
    • 2014-11-13
    • 1970-01-01
    • 1970-01-01
    • 2014-11-17
    • 2012-11-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多