安装

需求

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 add a note

User Contributed Notes 1 note

up
2
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