CentOS PHP 安装pthreads
super
2023-11-10 14:16

请先开启ZTS,如果未开启将会报以下错误

未开启ZTS,可参考这篇文章
https://rongsp.com/article/370.html
安装:
1)选择安装版本
https://pecl.php.net/package/pthreads

2)下载安装包
wget https://pecl.php.net/get/pthreads-3.1.2.tgz

3)查看

4)解压
tar zxvf pthreads-3.1.2.tgz
5)进入解压后的目录

6)安装
phpize

./configure

报错,手动加上php-config的路径
./configure --with-php-config=/www/server/php/72/bin/php-config
make
此时报了一堆错误

最后发现是因为官网的有问题,现在去github上面下载
https://github.com/krakjoe/pthreads/releases
wget https://github.com/krakjoe/pthreads/archive/refs/tags/v3.1.6.tar.gz
tar zxvf v3.1.6.tar.gz
cd pthreads-3.1.6/
ll

phpize
./configure --with-php-config=/www/server/php/72/bin/php-config

make

依然报错
改为最新版本

再来一次
wget https://github.com/krakjoe/pthreads/archive/refs/tags/v3.2.0.tar.gz
tar zxvf v3.2.0.tar.gz
cd pthreads-3.2.0/
ll
phpize
./configure --with-php-config=/www/server/php/72/bin/php-config
make

成功make
make install

7)查看

8)修改php配置文件
extension=pthreads.so

9)重载配置
重载后,PHP启动失败…. 查看日志

NOTICE: PHP message: PHP Fatal error: The fpm-fcgi SAPI is not supported by pthreads in Unknown on line 0
10)解决办法
https://segmentfault.com/q/1010000004327568

11)处理配置文件

发现宝塔安装的PHP已经有了
直接把php.ini新加的拓展删除,挪到php-cli.ini

12)重新启动PHP


13)查看是否正确安装
打开命令行
php -m

14)安装完成
0 条讨论