3

I want to install pthreads. When I'm trying to install I will receive this error:

checking for ZTS... no

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

now, how I can install Php with enabled Zts?

Shahrad Elahi
  • 774
  • 12
  • 22

1 Answers1

5

There I have a command list for enabling PHP-ZTS (7.2.26):

1- Change installation directory to home:

cd ~

2- Get PHP version you want:

wget http://www.php.net/distributions/php-7.2.26.tar.gz

3- Extract PHP file

tar zxvf php-7.2.26.tar.gz

4- Reconfigure sources

cd php-7.2.26 && ./buildconf --force

5- Inside the php-7.2.26 folder, run configure command to set what we need:

./configure --enable-debug --enable-maintainer-zts --prefix=/usr --with-config-file-path=/etc

6- Install PHP (maybe take 5 ~ 10 minutes for installation)

make && make install

7- Copy configuration file of PHP and add local lib to include path

cp php.ini-development /etc/php.ini

8- Edit php.ini and set Include_path to be like this:

Include_path = “/usr/local/lib/php”

Now you have installed php-7.2.26 with enabled ZTS.


UPDATE: Here is new command list for php-8.0 installation with ZTS.

1- Download and unpacking:

wget http://www.php.net/distributions/php-8.0.2.tar.gz && tar zxvf php-8.0.2.tar.gz

2- My server has need some packages, and you may face something else

yum install -y libxml2-devel sqlite-devel

3- Configuration (In this step, we're enabling the ZTS)

cd php-8.0.2 && ./buildconf --force && ./configure --enable-debug --enable-zts --prefix=/usr --with-config-file-path=/etc

4- Installation (This action may take few minutes)

make && make install

Congratulation now you installed new PHP version with enabled ZTS.

Shahrad Elahi
  • 774
  • 12
  • 22
  • 1
    This works great. I just did this with php 7.3.18 and everything went well. Just have in mind you have to enter php directory right after step 3. Thank you! – nanocv Jan 21 '21 at 16:07
  • Great answer, thanks. Do you know how to do this for PHP 8.0.2? "--enable-maintainer-zts" is not recognised by ./configure – Maz Feb 17 '21 at 00:44
  • @Maz use --enable-zts – Think Big Apr 16 '21 at 10:16