title: Enable Thread Safety in PHP+Apache2 on Ubuntu - compiling php from source with pthreads
body: <p>I'm trying to get pthreads running on my Ubuntu-Server (14.04) after I installed Apache2 and PHP5 via <code>apt-get</code>. 
  My initial steps:</p>
  
  <ol>
  <li>installed apache2 - <code>apt-get install apache2</code></li>
  <li>installed php5 with the usual modules <code>apt-get install php5 libapache2-mod-php5 php5-mcrypt ...</code></li>
  </ol>
  
  <p>Then i followed this tutorial to get pthreads running (<a href="http://php.net/manual/de/pthreads.installation.php" rel="nofollow">User contributed manual on php.net</a>):</p>
  
  <pre><code>1 - Get PHP version
  For this example we will use version: 5.4.36
  # wget http://www.php.net/distributions/php-5.4.36.tar.gz
  
  2- Get Pthreads version:
  I'm using an old version but, you could take any on
  # wget http://pecl.php.net/get/pthreads-1.0.0.tgz
  
  Extract both, php and pthreads versions
  
  #tar zxvf php-5.4.36.tar.gz
  #tar zxvf pthreads-1.0.0.tgz
  
  3- Move Pthreads to php/ext folder. Inside version of PHP downloaded at item 1.
  
  4- Reconfigure sources
  # ./buildconf --force
  # ./configure --help | grep pthreads
  
  You have to see --enable-pthreads listed. If do not, clear the buidls with this commands:
  
  # rm -rf aclocal.m4
  # rm -rf autom4te.cache/
  # ./buildconf --force
  
  5 - Inside php folder run configure command to set what we need:
  # ./configure --enable-debug --enable-maintainer-zts --enable-pthreads 
  
  --prefix=/usr --with-config-file-path=/etc
  6 - Install PHP
  We will run make clear just to be sure that no other crashed build will mess our new one.
  
  # make clear
  # make
  # make install
  
  7 - Copy configuration file of PHP and add local lib to include path
  # cp php.ini-development /etc/php.ini
  
  Edit php.ini and set Include_path to be like this:
  
  Include_path = “/usr/local/lib/php”
  
  9 - Check Modules
  # php -m (check pthread loaded)
  
  You have to see pthreads listed
  
  10 - If pthread is not listed, update php.ini
  # echo "extension=pthreads.so" &gt;&gt; /etc/php.ini
  </code></pre>
  
  <p>Everything works fine until step 7.
  There is a new directory (seems to be the <code>make install</code> - outcome) in <em>/usr/lib/php</em> . </p>
  
  <p>Now i don't know how to handle with replacing the existing php-installation with my new one. </p>
  
  <p><strong>Where do i have to copy the php.ini-development from step 7?</strong></p>
  
  <p>I tried <code>cp php.ini-development /etc/php.ini</code> 
  but it had no effect on my existing installation.</p>
  
  <p><strong>How can i get my new-compiled php working in / with apache2?</strong></p>
  
  <p>I found three php.ini-files from the initial installation on my server:</p>
  
  <pre><code>/etc/php5/apache2/php.ini
  
  /etc/php5/fpm/php.ini
  
  /etc/php5/cli/php.ini
  </code></pre>