1、下载pthreads的源码包https://pecl.php.net/package/pthreads如:pthreads-3.1.6.tgz2、解压> tar zxvf pthreads-3.1.6.tgz > cd pthreads-3.1.63、通过phpize命令生成configure> /data/nmp/php/bin/phpize4、生成好后,运行configure> ./configure --with-php-config=/data/nmp/php/bin/php-config(如果出现error: pthreads requires ZTS, please re-compile PHP with ZTS enabled的错误,说明在编译php时没有加入--enable-maintainer-zts,所以只能重新编译php)5、make && make install> make> make install6、如果出现如下信息,说明成功Installing shared extensions: /data/nmp/php/lib/php/extensions/no-debug-non-zts-20151012/7、修改php.iniextension_dir = "/data/nmp/php/lib/php/extensions/no-debug-non-zts-20151012/" extension=pthreads.so8、重启服务器,查看phpinfo()