title: How to install PHP pthreads extension on Ubuntu?
body: <p>I'd like to install the 'pthreads' PHP extension on Ubuntu. I'm using Ubuntu 12.04.1 LTS. And I can upgrade if needed. I really don't want to compile anything from source. For example recompile PHP from source sounds like a horrible idea to me.</p>
  
  <p>In my view, the best option is to install this extension with <code>aptitude</code> command. For example like <code>aptitude install php5-mysql</code>. Another good idea is to use pecl <code>pecl install pthreads</code>. But is does not work for me because of the following error:</p>
  
  <blockquote>
    <p>checking checking for ZTS... configure: error: pthreads requires ZTS, please re-compile PHP with ZTS enabled</p>
  </blockquote>
  
  <p>Let me explain why I don't like the idea to recompile PHP from source:</p>
  
  <ul>
  <li>I guess I should uninstall original PHP package then and all the dependencies. Because if I compile it over standard PHP then any packages update would overwrite my changes. And yes, another option is to keep PHP from updating. Anyway this introduces some extra work and makes the setup more complicated. We work in the distributed team. And I don't want other people to deal with this complicated setup on production servers.</li>
  <li>I want to install updates on servers. And I don't want to recompile PHP because of security fixes etc.</li>
  <li>I don't want to compile anything on production servers and do this many times. Then I should build my own packages and update them with new versions etc. Sorry but I'm not smart enough to do this. May be in 2-3 years but not now. Because there are a lot of things to keep in mind here. For example how, to replace standard PHP package with custom package while still satisfying all dependencies.</li>
  </ul>
  
  <p>Some references:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/15559918/dynamically-configure-php-for-thread-safety-enable-maintainer-zts-or-use-yum">Dynamically Configure PHP for Thread Safety --enable-maintainer-zts, or use YUM to install pThreads?</a></li>
  <li><a href="https://stackoverflow.com/questions/14081444/how-to-use-pthreads-php-extension-in-ubuntu">How to use Pthreads PHP extension (in Ubuntu)</a> - Some talks about what I'm going to do here.</li>
  <li><a href="http://pthreads.org/index.php?id=building" rel="nofollow noreferrer">Building pthreads</a></li>
  </ul>
  
  <p>This article seems to be old and not actual. I'll keep it for reference only. And I guess it should be read as 'PHP was not thread safe 3 years ago'.</p>
  
  <ul>
  <li><a href="http://neosmart.net/blog/2008/dont-believe-the-lies-php-isnt-thread-safe-yet/" rel="nofollow noreferrer">Don’t Believe The Lies: PHP Isn’t Thread-Safe Yet</a></li>
  </ul>