I am trying to install pthreads on my Ubuntu 12.04 server that is running PHP Version 5.5.8-3+sury.org~precise+2. To my knowledge this was just a standard installation via apt-get.
I then try and run
sudo pecl install pthreads
this produces the following error:
checking checking for ZTS... configure: error: pthreads requires ZTS, please re-compile PHP with ZTS enabled
I understand that this means PHP was not compiled with the --enable-maintiner-zts ./config flag.
What I DON'T know how to do is recompile PHP with this flag and then overwrite my current PHP installation, hopefully without breaking anything.
I have done some googling on the subject but the few guides I have found are extremely high level, old, or not very complete, and sadly I am still somewhat of a novice when it comes to Linux.
Put all your excuses in a box ... burn the box, and forget about them.
You are dabbling in rather advanced PHP, and have already identified correctly the problem ... don't be scared, just crack on ...
Here's some ramblings about configuring PHP to overwrite your installation ...
Lets say I have PHP at /usr, scandir at /etc/php.d and configuration at /etc/php.ini
./configure --prefix=/usr --bindir=/usr/bin --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d
That minimal configuration would overwrite my installation, I have included --bindir because by setting that single configuration option you are able to isolate an installation of PHP at, for example, /opt/php-zts.
You require, at least, the additional option
--enable-maintainer-zts
You should inspect your current installation, make a note of the extensions enabled and just work your way up from the default.
If an extension should fail to build, it will usually be because the headers for the library the extension is wrapping are not available on your system, it's usually the case that installation of the dev, or devel package, using your distros package manager will allow the build to succeed.
Once you have a working full build, its good advice to copy config.nice to somewhere sensible so that you have it for the future.
Lastly it's not always desirable to actually overwrite the installation on your system, other software may be using that, so I usually say it's better to isolate an installation, here's a config.nice verbatim from an isolated install on my machine:
#! /bin/sh
#
# Created by configure
'./configure' \
'--with-apxs2=/opt/php-zts/bin/apxs' \
'--prefix=/opt/php-zts' \
'--bindir=/opt/php-zts/bin' \
'--with-config-file-dir=/opt/php-zts' \
'--with-config-file-scan-dir=/opt/php-zts/modules.d/' \
'--with-curl=shared,/usr' \
'--with-zlib' \
'--with-libxml2' \
'--enable-simplexml' \
'--with-mysql=mysqlnd' \
'--with-pdo-mysql=mysqlnd' \
'--enable-gd-native-ttf' \
'--with-mysqli' \
'--disable-phar' \
'--enable-shared' \
'--enable-maintainer-zts' \
'--enable-opcache' \
'--enable-sockets' \
'--with-curl=shared' \
'--enable-pcntl=shared' \
'--enable-mbstring' \
"$@"