Difference between revisions of "PHP pthreads extension"

From ArchWiki
Jump to: navigation, search
(Install the 'apcu' package for APC support back)
m (A few minor grammar corrections)
Line 1: Line 1:
If you wish to have POSIX multi-threading you will need the pthreads extension. to install the pthreads (http://pecl.php.net/package/pthreads) extension using {{ic|pecl}} you are required to use a compiled version of PHP with the the thread safety support flag {{ic|--enable-maintainer-zts}}. currently the most clean way to do this would be to rebuild the original package with the flag.
+
If you wish to have POSIX multi-threading you will need the pthreads extension. To install the pthreads (http://pecl.php.net/package/pthreads) extension using {{ic|pecl}} you are required to use a compiled version of PHP with the the thread safety support flag {{ic|--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 dependent on the {{Pkg|php}} package, for example:
+
Check what packages depend on the {{Pkg|php}} package, for example:
  
 
{{hc|pacman -Qii php|
 
{{hc|pacman -Qii php|
Line 11: Line 11:
 
}}
 
}}
  
Remove all of them including 'php', so:
+
Remove all of them including 'php', for example:
  
 
{{bc|pacman -R php php-apache php-apcu php-mcrypt php-pear php-pgsql}}
 
{{bc|pacman -R php php-apache php-apcu php-mcrypt php-pear php-pgsql}}
Line 21: Line 21:
 
}}
 
}}
  
Make changes to add threads support
+
Make the changes to add threads support
  
 
{{bc|vim PKGBUILD}}
 
{{bc|vim PKGBUILD}}

Revision as of 16:48, 15 November 2013

If you wish to have POSIX multi-threading you will need the pthreads extension. To install the pthreads (http://pecl.php.net/package/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://projects.archlinux.org/svntogit/packages.git
cd packages/php/trunk

Make the changes to add threads support

vim PKGBUILD

Should look something like

...
--with-xsl=shared \
--with-zlib \
--enable-maintainer-zts
...

Make the new packages

makepkg -s

Install the packages you removed

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

Install pthreads

pecl install pthreads

Install the 'apcu' package for APC support back

cd ../../php-apcu/trunk
makepkg -si