Recompile PHP with ZTS enabled on Ubuntu

I am trying to install pthreads with

pecl install pthreads

      

But I got this error during installation

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

      

I was looking for this error. It seems that I need to install a newer version of PHP with ZTS enabled. Are there easier ways to recompile with ZTS enabled instead of reinstalling PHP?

+3


source to share


1 answer


Here is the quoted answer from the Digital Ocean community:



ZTS support is a time setting option and cannot be enabled at startup time. You will need to build php yourself with --enable-maintainer-zts

to enable it.

One way to do this is to modify an existing package and rebuild it. First, we will need to install and download a few things:

Install build dependencies:

sudo apt-get build-dep php5

      

Install developer tools:

sudo apt-get install devscripts

      

Download the source code:

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 to customize flags:

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

      

Then we want to jot down the version number for the package, so this is above the PHP version 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

      

The package can now be built using the command:

DEB_BUILD_OPTIONS=nocheck debuild

      

It will take quite a long time and also require some memory. If you are on a 512MB server, you will probably need to add some swap.

Several packages will be created in the parent directory:

cd ..
ls *deb

      

You can now install individual packages with sudo dpkg -i pakage_name.deb

or all of them withsudo dpkg -i *deb

+7


source







All Articles