Re compile php with zts enabled

How to enable ZTS on PHP?

Having said all that, the ZTS mode is not about allowing threading inside PHP scripts, but rather to allow for PHP itself to run in a threaded environment. Congratulation now you installed new PHP version with enabled ZTS.

How to enable ZTS on PHP?

i try to install pthreads with (pecl install pthreads-beta) and get this error

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

know anyone how to install ?

To turn them on, pass the —enable-debug and —enable-maintainer-zts options to configure, along with whatever options you typically use

Pthreads — Enable ZTS on PHP without compiling, Teams. Q&A for work. Connect and share knowledge within a single location that is structured and easy to search.

How to Install PHP-Zts manually on the Centos 7

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?

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

1- Change installation directory to home:

2- Get PHP version you want:

wget http://www.php.net/distributions/php-7.2.26.tar.gz 
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)

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.

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)

Congratulation now you installed new PHP version with enabled ZTS.

Why PHP has separate version of ts(thread safe)/nts, The TS version of PHP keeps the state of each request in its own memory location. This is necessary because all requests in a multi-threaded server share the same address space. The alternative is to use a multi-process (usually prefork) server. With such a server some state can be kept in global variables …

Why PHP ZTS is disabled by default?

Why ZTS is disabled by default and we should compile PHP source to achieve Threading ability? Is there any limitation or side effect when we enable ZTS ? Is it unstable?

PHP originally started out as a CGI binary, and then as a module for Apache. Neither of these two ways required PHP to be a threaded run time as they would all handle a request in sequence.

When support for other web servers, most notably Microsoft’s IIS through their ISAPI interface, was added, their processing model required PHP to be able to run as a threaded process. PHP added a «ZTS» (Zend Thread Safe ) mode that does a fair bit of work to make sure that requests that run in parallel (threaded) don’t step on each others toes. But this does come at a performance cost .

As most web server APIs don’t require ZTS to be enabled, the default for PHP is for that to be off. If you were to build PHP for the ISAPI SAPI (Server Abstraction) layer, then the PHP build process automatically turns on ZTS mode.

Having said all that, the ZTS mode is not about allowing threading inside PHP scripts , but rather to allow for PHP itself to run in a threaded environment. If you are interested in running things in parallel from a PHP’s script point of view, you need to resort to third party extensions such as Joe’s parallel extension, or swoole.

How to compile php extension for PHP 5.3.6 with debug, I’ve tried to create some php extension. For the first I compiled php 5.3.6 with —enable-debug —enable-maintainer-zts. Then I ceated my extension and use standart procedure for it. phpize ./configure —with-EXTNAME make Then copy extname.so to my php extensions directory, and change php.ini. And when I try to use php from …

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

krakjoe / pthreads Public archive

Problem with installation even though ZTS is enabled #61

Problem with installation even though ZTS is enabled #61

Comments

I tried installing pthreads both through PECL and by cloning this git repository. Both failed with the following output:

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

However, ZTS is enabled, at least in CLI version of PHP. Here is the relevant output of ‘php -i’:

PHP Version => 5.3.2-1ubuntu4.18 Configure Command => '../configure' '--build=i486-linux-gnu' '--host=i486-linux-gnu' '--disable-all' '--prefix=/usr' '--with-config-file-path=/etc/php5/clibare' '--enable-maintainer-zts' '--enable-pthreads' '--enable-xml' '--enable-libxml' '--with-config-file-scan-dir=/etc/php5/clibare/conf.d' '--with-mysql=shared,/usr/lib' '--with-curl=shared,/usr' '--enable-pcntl' '--enable-posix' '--enable-json' '--with-gmp=shared,/usr' '--with-system-tzdata' Thread Safety => enabled 

System info: Ubuntu 10.04 with PHP 5.3.2

successful installation/compilation of pthreads

php5-5.3.2/ext/pthreads# ./configure checking for grep that handles long lines and -e. /bin/grep checking for egrep. /bin/grep -E checking for a sed that does not truncate output. /bin/sed checking for cc. cc checking whether the C compiler works. yes checking for C compiler default output file name. a.out checking for suffix of executables. checking whether we are cross compiling. no checking for suffix of object files. o checking whether we are using the GNU C compiler. yes checking whether cc accepts -g. yes checking for cc option to accept ISO C89. none needed checking how to run the C preprocessor. cc -E checking for icc. no checking for suncc. no checking whether cc understands -c and -o together. yes checking for system library directory. lib checking if compiler supports -R. no checking if compiler supports -Wl,-rpath. yes checking build system type. i686-pc-linux-gnu checking host system type. i686-pc-linux-gnu checking target system type. i686-pc-linux-gnu checking for PHP prefix. /usr checking for PHP includes. -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 checking for PHP extension directory. /usr/lib/php5/20090626+lfs checking for PHP installed headers prefix. /usr/include/php5 checking if debug is enabled. no checking if zts is enabled. no checking for re2c. re2c checking for re2c version. 0.13.5 (ok) checking for gawk. gawk checking whether to enable Threading API. yes, shared checking checking for ZTS. configure: error: pthreads requires ZTS, please re-compile PHP with ZTS enabled 

Steps to reproduce this error:

apt-get source php5 cd php5-5.3.2 # add '--enable-maintainer-zts' and '--enable-pthreads' to configure line for cli version dpkg-buildpackage cd .. dpkg -i php5-common_5.3.2-1ubuntu4.18_i386.deb dpkg -i php5-cli_5.3.2-1ubuntu4.18_i386.deb pecl install pthreads-beta # OR clone via git and use phpize + ./configure 

The text was updated successfully, but these errors were encountered:

I tried this install script, but it failed with the following output:

Downloading PHP 5.4.11 from uk1.php.net . Downloading pthreads 0.0.42 . Unpacking pthreads 0.0.42 . grep: configure.in: No such file or directory Forcing buildconf Removing configure caches make: build/build.mk: No such file or directory make: *** No rule to make target `build/build.mk'. Stop. Error: failed to configure PHP 

I don’t know why it’s not finding these files.

Try following the steps in the script, ensure you have autoconf and build-essential installed, there’s not much else I can do to help, sorry 🙁

There’s a slight problem at line 51:
/$PHP_CONF_ROOT/php-$PHP_VERSION/buildconf —force &&
‘buildconf’ route’s not that, but
/$PHP_CONF_ROOT/php-$PHP_VERSION/TSRM/buildconf —force && \

buildconf should not be in /TSRM, buildconf is the script that creates the «configure» script, it should reside in the root directory of the source .

Obviously. I just marked that out, so that robguinness had a clue of why the script was dying at that point, for no apparent reason.

I had the exact same issue as rob.

JM’s TSRM directory suggestion then allowed the script to proceed, but the building of PHP ultimately failed:

«configure: WARNING: unrecognized options: —enable-pthreads»

Honestly, I have «Thread Safety => enabled» also. Therefore, the following should have worked, without question:

Folks shouldn’t get an error that says:

«pthreads requires ZTS, please re-compile PHP with ZTS enabled»

«Thread Safety => enabled» and «Thread Safety: On»

That being said, thank you for all the help you’ve kindly volunteered for this.

I use latest version and I have same problem.

wget https://github.com/krakjoe/pthreads/archive/master.zip (8f4205d527fc9fb2bed8f95861635a60a41a2758) # cat /etc/os-release NAME="CentOS Linux" VERSION="7 (Core)" ID="centos" ID_LIKE="rhel fedora" VERSION_ID="7" PRETTY_NAME="CentOS Linux 7 (Core)" # cat /proc/version Linux version 3.10.0-957.10.1.el7.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC) ) #1 SMP Mon Mar 18 15:06:45 UTC 2019 # php -v PHP 7.3.5 (cli) (built: May 26 2019 18:05:43) ( ZTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.3.5, Copyright (c) 1998-2018 Zend Technologies # /usr/local/bin/php -v PHP 7.3.5 (cli) (built: May 26 2019 18:05:43) ( ZTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.3.5, Copyright (c) 1998-2018 Zend Technologies # /usr/bin/php -v PHP 7.3.5 (cli) (built: May 26 2019 18:05:43) ( ZTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.3.5, Copyright (c) 1998-2018 Zend Technologies # phpize Configuring for: PHP Api Version: 20131106 Zend Module Api No: 20131226 Zend Extension Api No: 220131226 # ./configure checking for grep that handles long lines and -e. /usr/bin/grep checking for egrep. /usr/bin/grep -E checking for a sed that does not truncate output. /usr/bin/sed checking for cc. cc checking whether the C compiler works. yes checking for C compiler default output file name. a.out checking for suffix of executables. checking whether we are cross compiling. no checking for suffix of object files. o checking whether we are using the GNU C compiler. yes checking whether cc accepts -g. yes checking for cc option to accept ISO C89. none needed checking how to run the C preprocessor. cc -E checking for icc. no checking for suncc. no checking whether cc understands -c and -o together. yes checking for system library directory. lib checking if compiler supports -R. no checking if compiler supports -Wl,-rpath. yes checking build system type. x86_64-unknown-linux-gnu checking host system type. x86_64-unknown-linux-gnu checking target system type. x86_64-unknown-linux-gnu checking for PHP prefix. /usr/local checking for PHP includes. -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib checking for PHP extension directory. /usr/local/lib/php/extensions/no-debug-non-zts-20131226 checking for PHP installed headers prefix. /usr/local/include/php checking if debug is enabled. no checking if zts is enabled. no checking for re2c. no configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers. checking for gawk. gawk 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 

Whilst the PHP binary you’re referring to is ZTS safe, the corresponding PHP configuration files being used are not. You can see this in the output of ./configure :

. checking for PHP extension directory. /usr/local/lib/php/extensions/no-debug-non-zts-20131226 . checking if zts is enabled. no 

Did you just replace the php binary, rather than running make install to replace the corresponding configuration files too? I know there’s a way to use configuration files from another directory than the default being used here, but can’t remember what the flag for this is.

Источник

Читайте также:  Php mysql select query function
Оцените статью