安装

需求

parallel 要求启用 ZTS(Zend 线程安全)PHP 编译(--enable-zts,或者 PHP 8.0.0 之前的非 Windows 系统是 --enable-maintainer-zts

警告

Zend 线程安全在编译后无法启用,因为他是编译时的配置项。

parallel 应该在任何有有效的 Posix Thread 头文件(pthread.h)和 PHP ZTS 的地方编译,包含 Windows(使用 redhat 的 pthread-w32 项目)。

安装

parallel 版本由 PECL 托管,源代码由 » github 托管,最简单的安装办法是使用 PECL 安装 » https://pecl.php.net/package/parallel.

Windows 用户可以从 » PECL 网站下载预编译的已发布的二进制文件。

警告

Windows 用户需要采取额外的步骤,将 pthreadVC2.dll(随 Windows 一起发布)添加到 PATH 中。

add a note

User Contributed Notes 3 notes

up
5
Anonym
1 year ago
As it seems, the last compiled Windows version is for PHP 7.4 which PHP 8.x refuses to load as extension. In his GitHub repository the author of the parallels extension wrote on August 2021 that the project is "probably a dead end" and the project hasn't been updated since 2 years.
up
5
Mike
1 year ago
Version 1.2.0, released on October 24, 2022, supports PHP 8.0.0.
up
4
andre at webtechnik dot ch
2 years ago
On Windows Systems:

- Install PHP TS (Thread Safe)
- Download Extension from PECL (PHP-Version, Thread Safe (TS), Compiler - Version (VC15, VC16), Architecture must match)
- Copy extension to folder: <your php dir>/ext/php_parallel.dll
- Copy app to folder: <your php dir>/pthreadVC2.dll (It is important to copy pthreadVC2.dll not into the ext folder!)
- add pthreadVC2.dll to windows system environment path
- add in php.ini the line extension=parallel to load the extension
- restart

Try on console: php -v

If there are no errors, everything works and you can try the examples
To Top