1

I have been using the version of PHP7 that is available for Fedora 23 in the remi repositories and it has worked fine. I recently found I need to compile PHP7 from source to get Pthreads working, which also requires compiling PHP with the option: --enable-maintainer-zts. I have found though, that no matter what options I use to compile PHP, they are not being used when PHP is run by the OS. if I use php -i in the terminal, I see that thread safety is off and the other options I have set are not listed. I did uninstall the remi version of PHP, but that made no difference - however, this led to a strange situation, in that PHP was still operating via PHP-FPM after I had removed the remi version of PHP from my machine. This appears to me to mean that I'm running the version of PHP7 that I have built from source, but that my directives have been ignored. if that is not the case, then I have no other idea how this is possible, except that possibly PHP was not actually removed from my machine when I ran DNF REMOVE PHP (and simultaneously the version I installed from source was just ignored or incorrectly installed).

I have used a few different build commands, with the last one being:

./configure --prefix=/usr/local/php --with-zlib-dir --with-freetype-dir --enable-mbstring --with-libxml-dir=/usr --enable-soap --enable-calendar --with-curl --with-mcrypt --with-zlib --with-gd --disable-rpath --enable-inline-optimization --with-bz2 --with-zlib --enable-sockets --enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex --enable-exif --enable-bcmath --with-mhash --enable-zip --with-pcre-regex --with-mysqli --with-pdo-mysql --with-mysqli --with-jpeg-dir=/usr --with-png-dir=/usr --enable-gd-native-ttf --with-openssl --with-fpm-user=nginx --with-fpm-group=nginx --with-libdir=/usr/lib64/php-zts --enable-ftp --with-kerberos --with-gettext --with-xmlrpc --with-xsl --enable-opcache --enable-fpm --enable-maintainer-zts --enable-debug

When I examine the timestamps on various files for PHP, most have so far not matched the date/time that I built PHP from source.

Does anyone have an intuition as to what I'm missing here?

tunist
  • 15
  • 1
  • 8

1 Answers1

0

No need to build, packages in remi (or Fedora) repository have ZTS build and pthreads extension, you need to use the zts-php command (pthreads extension is CLI only)

# yum --enablerepo=remi-php70 install php-pecl-pthreads
...
# zts-php -m | grep thread
pthreads

You can check the PECL extension RPM status in remi repository (which show pthreads is available)

Remi Collet
  • 6,198
  • 1
  • 20
  • 25
  • how do i install the version of PHP7 that includes the ZTS configuration option enabled? i do already have the php-pecl-pthreads package installed, but that isn't going to enable the threads option in PHP, is it? i thought i needed to install that extension and also activate thread safety in PHP itself. everything i have found so far says i need to recompile PHP - e.g. here: http://stackoverflow.com/questions/17272439/how-to-enable-zts-on-php – tunist Jul 15 '16 at 00:13
  • As said above, packages in remi repository have ZTS build. So php-cli package provides the "php" (NTS) and the "zts-php" (ZTS=Thread Safe) command) – Remi Collet Jul 17 '16 at 15:19
  • oh ok, well since i have never seen 'thread safety' show up as enabled in the phpinfo() output page, i thought that thread safety is not enabled. i just reinstalled the version of PHP7.0.8 that is available via the remi repo and i still see that thread safety is disabled in phpinfo(). when i ran the zts-php -m command, i got the result 'pthreads' via the command line. – tunist Jul 18 '16 at 10:57
  • "when i ran the zts-php -m command, i got the result 'pthreads' via the command line." => So problem solved ;) – Remi Collet Jul 18 '16 at 12:24
  • i think you have misunderstood me here. when i run "php -i" i see: "Thread Safety => disabled". this needs to be set to 'enabled', doesn't it? – tunist Jul 18 '16 at 13:15
  • Please read above comment. "php-cli package provides the "php" (NTS) and the "zts-php" (ZTS=Thread Safe) command)". So try "zts-php -i" – Remi Collet Jul 18 '16 at 14:57
  • oh, i see - i have not seen zts-php mentioned anywhere in the pages i have been researching. so now i am wondering how to use zts-php instead of the standard php. also, i am confused about your statement that pthreads is command-line only, because my main intention here is to use a PHP class that allows calling of meteor functions remotely (https://github.com/zyzo/meteor-ddp-php) and as far as i can see, the class is intended for normal (non command line) use. any tips/thoughts are welcome! – tunist Jul 18 '16 at 19:20
  • See https://github.com/krakjoe/pthreads => "you can't use pthreads safely and sensibly anywhere but CLI." – Remi Collet Jul 19 '16 at 05:55
  • ok, i am willing to trust the coder of pthreads over the others that advised me to use it on a webserver ;) - thanks for assisting. – tunist Jul 19 '16 at 20:22