簡體   English   中英

PHP,啟用 ZTS、Pthreads

[英]PHP, enable ZTS, Pthreads

我需要在 php 中啟用 ZTS。 因此,我使用“--enable-maintainer-zts”選項從源代碼重新編譯了 php。 我現在有:
“php -v”

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”

Thread Safety => enabled

現在我正在嘗試做
“sudo pecl install pthreads”回答我

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.

安裝編譯php的所有依賴,fedora/cent os的參考在這里

然后這是我使用的腳本,只是制作一個文件 php-zts-installer.sh 擴展名並以超級用戶sudo ./php-zts-installer.sh運行它sudo ./php-zts-installer.sh

php-zts-install.sh 的內容

#!/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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM