https://wiki.archlinux.org/api.php?action=feedcontributions&user=Justrafi&feedformat=atomArchWiki - User contributions [en]2024-03-28T21:28:29ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=PHP/pthreads_extension&diff=282985PHP/pthreads extension2013-11-15T16:48:37Z<p>Justrafi: A few minor grammar corrections</p>
<hr />
<div>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.<br />
<br />
Check what packages depend on the {{Pkg|php}} package, for example:<br />
<br />
{{hc|pacman -Qii php|<br />
:: php-apache: requires php<br />
:: php-apcu: requires php<br />
:: php-mcrypt: requires php<br />
:: php-pear: requires php<br />
:: php-pgsql: requires php<br />
}}<br />
<br />
Remove all of them including 'php', for example:<br />
<br />
{{bc|pacman -R php php-apache php-apcu php-mcrypt php-pear php-pgsql}}<br />
<br />
Clone Archlinux's official package repository<br />
{{bc|cd /opt/<br />
git clone git://projects.archlinux.org/svntogit/packages.git<br />
cd packages/php/trunk<br />
}}<br />
<br />
Make the changes to add threads support<br />
<br />
{{bc|vim PKGBUILD}}<br />
<br />
Should look something like<br />
{{bc|<nowiki><br />
...<br />
--with-xsl=shared \<br />
--with-zlib \<br />
--enable-maintainer-zts<br />
...<br />
</nowiki>}}<br />
<br />
Make the new packages<br />
<br />
{{bc|makepkg -s}}<br />
<br />
Install the packages you removed<br />
{{bc|<br />
pacman -U \<br />
php-5.5.6-1-x86_64.pkg.tar.xz \<br />
php-apache-5.5.6-1-x86_64.pkg.tar.xz \<br />
php-mcrypt-5.5.6-1-x86_64.pkg.tar.xz \<br />
php-pear-5.5.6-1-x86_64.pkg.tar.xz \<br />
php-pgsql-5.5.6-1-x86_64.pkg.tar.xz<br />
}}<br />
<br />
Install pthreads<br />
{{bc|pecl install pthreads}}<br />
<br />
===Install the 'apcu' package for APC support back===<br />
{{bc|<br />
cd ../../php-apcu/trunk<br />
makepkg -si<br />
}}</div>Justrafi