首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >PHP,启用ZTS,Pthread

PHP,启用ZTS,Pthread
EN

Stack Overflow用户
提问于 2016-10-03 18:55:24
回答 1查看 6K关注 0票数 5

我需要在php中启用ZTS。所以我用'--enable-maintainer-zts‘选项从源代码重新编译了php。现在我有了:

"php -v“

代码语言:javascript
复制
PHP 7.0.11 (cli) (built: Oct  3 2016 12:19:10) ( ZTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies

"php -i“

代码语言:javascript
复制
Thread Safety => enabled

现在我想做的是

"sudo pecl install pthread“回答我的问题

代码语言:javascript
复制
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: `/var/tmp/pthreads/configure --with-php-config=/usr/bin/php-config' failed

请帮帮我。怎么了?

CentOS 7。

EN

回答 1

Stack Overflow用户

发布于 2018-10-22 23:31:24

安装编译php的所有依赖项,对fedora/cent os的引用是here

然后这是我使用的脚本,只需创建一个文件php-zts-installer.sh扩展并以超级用户sudo ./php-zts-installer.sh身份运行它

php-zts-install.sh的内容

代码语言:javascript
复制
#!/bin/bash

mkdir -p /etc/php7
mkdir -p /etc/php7/cli

git clone https://github.com/php/php-src.git -b PHP-7.0.17 --depth=1
cd php-src/ext
git clone https://github.com/krakjoe/pthreads -b master pthreads

cd ..

./buildconf --force

./configure --prefix=/etc/php7 --with-bz2 --with-zlib --enable-zip --disable-cgi \
    --enable-soap --enable-intl --with-mcrypt --with-openssl --with-readline --with-curl \
    --enable-ftp --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \
    --enable-sockets --enable-pcntl --with-pspell --with-enchant --with-gettext \
    --with-gd --enable-exif --with-jpeg-dir --with-png-dir --with-freetype-dir --with-xsl \
    --enable-bcmath --enable-mbstring --enable-calendar --enable-simplexml --enable-json \
    --enable-hash --enable-session --enable-xml --enable-wddx --enable-opcache \
    --with-pcre-regex --with-config-file-path=/etc/php7/cli \
    --with-config-file-scan-dir=/etc/php7/etc --enable-cli --enable-maintainer-zts \
    --with-tsrm-pthreads --enable-debug --enable-fpm \
    --with-fpm-user=www-data --with-fpm-group=www-data

make && make install

chmod o+x /etc/php7/bin/phpize
chmod o+x /etc/php7/bin/php-config

cd ext/pthreads*
/etc/php7/bin/phpize

./configure --prefix=/etc/php7 --with-libdir=/lib/x86_64-linux-gnu --enable-pthreads=shared --with-php-config=/etc/php7/bin/php-config

make && make install

cd ../../
cp -r php.ini-development /etc/php7/cli/php.ini

cp php.ini-development /etc/php7/cli/php-cli.ini
echo "extension=pthreads.so" > /etc/php7/cli/php-cli.ini
echo "zend_extension=opcache.so" >> /etc/php7/cli/php.ini

ln --symbolic /etc/php7/bin/php /usr/bin/php

export USE_ZEND_ALLOC=0
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/39829944

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档