[英]How to compile PHP 7.1 with ZTS
我在github PThread項目頁面上看到支持php7+。
我在 ubuntu 發行版 (16.04) 上有 php7.1.6
我找不到任何提供 php7.1-zts 的 PPA。
如何在 php7.1 上啟用 zts 來安裝 pthreads?
這是我的設置腳本
#!/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
你也可以使用我的docker pull buildok/zts
-container docker pull buildok/zts
在 Ubuntu 服務器上
我把版本改成了 7.4.16
git clone https://github.com/php/php-src.git -b PHP-7.0.17 --depth=1
在能夠重新編譯 PHP 之前,我必須安裝一些依賴項。
需要的包是:
apt install bison re2c zlib1g-dev sqlite3 libsqlite3-dev libbz2-dev libcurl4-openssl-dev libenchant-dev libonig-dev libpspell-dev libedit-dev libreadline-dev libxslt-dev
還警告:無法識別的選項:--enable-zip、--with-mcrypt、--with-gd、--with-jpeg-dir、--with-png-dir、--with-freetype-dir、-啟用哈希,--enable-wddx,--with-pcre-regex
所以使用 php 7.4 你可能想要做: ./configure --prefix=/etc/php7 --with-bz2 --with-zlib --enable-zip --disable-cgi \\ --enable-soap --enable-intl 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 \\ --enable-exif --with-xsl \\ --enable-bcmath --enable-mbstring --enable-calendar --enable-simplexml --enable-json \\ --enable-session --enable-xml --enable-opcache \\ --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
之后你會發現php7.4與pthreads不兼容,你會發現這個錯誤,維護者已經停止了pthreads的開發並轉向了並行。 https://github.com/krakjoe/pthreads/issues/929
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.