需求

要使用 pthreads 擴展,需要構建 PHP 時啟用 ZTS (Zend Thread Safety)。(--enable-maintainer-zts 選項, Windows 平臺為 --enable-zts)

警告

ZTS 是構建期配置選項,只能通過構建時通過選項啟用,無法在構建之后啟用。

要構建 pthreads 擴展,你需要啟用了 ZTS 的 PHP 以及 Posix Threads 頭文件(pthread.h)。對于 Windows 平臺,需要使用 redhat 的 pthread-w32 項目中的 pthread.h 頭文件。