[英]pthread setup for apache2
我正在使用Ubuntu 14.10(c9.io),并将我的PHP从5.6升级到7.2。
我需要将pthread用于apache2的多线程。 我正在尝试使用sudo pecl install pthreads安装pthread
但这给了我以下错误:
checking whether to enable pthreads... yes, shared
checking whether to enable AddressSanitizer for pthreads... no
checking whether to enable dmalloc for pthreads... no
checking for ZTS... configure: error: pthreads requires ZTS, please re-compile PHP with ZTS enabled
ERROR: `/tmp/pear/temp/pthreads/configure --with-php-config=/usr/bin/php-config' failed
我试图为此找到一些解决方案,但没有成功。 每个解决方案都是从头开始安装PHP,而不是重新编译现有的PHP安装程序。
请建议是否有任何方法可以将pthread用于apache2 php 7.2设置。
作为示例,以PHP 7.0
并查看步骤。 通过检查错误,您可能需要ZTS
1.安装启用ZTS的PHP
没有php7.0-zts-xml
和php7.0-zts-dev
软件包,pThreads将无法安装,因此还必须安装以下软件包:
sudo apt -y install php7.0-zts php7.0-zts-common php7.0-zts-xml php7.0-zts-dev
2.检查ZTS是否已启用
这应该返回1
的整数。
php -r "echo PHP_ZTS;"
3.通过Pecl安装pThreads
sudo apt install php-pear
sudo pecl install pthreads
sudo echo "extension=pthreads.so" >> /etc/php/7.0-zts/mods-available/pthreads.ini
sudo echo "extension=pthreads.so" >> /etc/php/7.0-zts/cli/conf.d/pthreads.ini
4.检查是否已安装pThreads
这应该返回整数“ 1”。
php -r "print_r(class_exists('Thread'));"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.