PHP pthreads extension

From ArchWiki
Revision as of 12:40, 11 January 2014 by Wdna (Talk | contribs)

Jump to: navigation, search

If you wish to have POSIX multi-threading you will need the pthreads extension. To install the pthreads ( extension using pecl you are required to use a compiled version of PHP with the the thread safety support flag --enable-maintainer-zts. currently the most clean way to do this would be to rebuild the original package with the proper flag.

Check what packages depend on the php package, for example:

pacman -Qii php
:: php-apache: requires php
:: php-apcu: requires php
:: php-mcrypt: requires php
:: php-pear: requires php
:: php-pgsql: requires php

Remove all of them including 'php', for example:

pacman -R php php-apache php-apcu php-mcrypt php-pear php-pgsql

Clone Archlinux's official package repository

cd /opt/
git clone git://
cd packages/php/repos/extra-x86_64

Make the changes to add threads support


Should look something like

--with-xsl=shared \
--with-zlib \

Make the new packages

makepkg -s

Install the packages you removed

pacman -U \
php-5.5.8-1-x86_64.pkg.tar.xz \
php-apache-5.5.8-1-x86_64.pkg.tar.xz \
php-mcrypt-5.5.8-1-x86_64.pkg.tar.xz \
php-pear-5.5.8-1-x86_64.pkg.tar.xz \

Install pthreads

pecl install pthreads

Install the 'apcu' package for APC support back

cd ../../../php-apcu/repos/extra-x86_64/
makepkg -si