gpt4 book ai didi

php - 在 Ubuntu 上启用 ZTS 重新编译 PHP

转载 作者:塔克拉玛干 更新时间:2023-11-03 06:05:02 24 4
gpt4 key购买 nike

我正在尝试使用

安装 pthreads
pecl install pthreads

但是我在安装的时候出现了这个错误

configure: error: pthreads requires ZTS, please re-compile PHP with ZTS enabled

我已经搜索过这个错误。看来我必须安装启用 ZTS 的新版本的 PHP。有没有更简单的方法可以在启用 ZTS 的情况下重新编译而不是重新安装 PHP?

最佳答案

这是来自 digital ocean 社区的引用答案comment :

ZTS support is a configure time option and can not be enabled at run time. You'll need to build php yourself with the --enable-maintainer-zts flag in order to enable it.

One way to do this is to modify the existing package and rebuild it. First we'll need to install and download a few things:

Install the build dependencies:

sudo apt-get build-dep php5

Install the developer tools:

sudo apt-get install devscripts

Download the source:

apt-get source php5

Now enter the source directory and edit the debian/rules file:

cd php5-5.5.9+dfsg/    # The version will be different depending on the Ubuntu release
nano debian/rules

Find the section starting with COMMON_CONFIG=--build=$(DEB_BUILD_GNU_TYPE) \ and add the following configure flags:

        --enable-maintainer-zts \
--enable-pthreads \

Then we want to bump the version number for the package, so that it is higher than the version of PHP in the repository. Run dch -i and create a new changelog entry:

php5 (5.5.9+dfsg-1ubuntu4.5+zts1) trusty; urgency=medium

* Rebuild with ZTS support.

-- You <doesnt@matter.com> Mon, 10 Nov 2014 13:14:32 -0500

Now the package can be built using the command:

DEB_BUILD_OPTIONS=nocheck debuild

This will take quite awhile and will also require some memory. If you're on a 512mb server, you'll probably need to add some swap.

It will produce a number of packages in the parent directory:

cd ..
ls *deb

You can now install the individual packages with sudo dpkg -i
pakage_name.deb
or all of them with sudo dpkg -i *deb

关于php - 在 Ubuntu 上启用 ZTS 重新编译 PHP,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30159687/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com