SunshinePHP Developer Conference 2015

Installation

pthreads releases are hosted by PECL and the source code by » github, the easiest route to installation is the normal PECL route: » http://pecl.php.net/package/pthreads.

Windows users can download prebuilt release binaries from the » PECL website.

Caution

Windows users need to take the additional step of adding pthreadVC2.dll (distributed with Windows releases) to their PATH.

add a note add a note

User Contributed Notes 9 notes

up
12
zahid dot smz at gmail dot com
5 months ago
For Wampp (Windows)
-----------------------------------------------------------------------------------
1.  Find out what is your 'PHP Extension Build' version by using phpinfo(). You can use this - http://localhost/?phpinfo=1

2.  Download the pthreads that matches your php version (32 bit or 64 bit) and php extension build (currently used VC11). Use this link for download - http://windows.php.net/downloads/pecl/releases/pthreads/

3.  Extract the zip -
      Move php_pthreads.dll to the 'bin\php\ext\' directory.
      Move pthreadVC2.dll to the 'bin\php\' directory.
      Move pthreadVC2.dll to the 'bin\apache\bin' directory.
      Move pthreadVC2.dll to the 'C:\windows\system32' directory.

4.  Open php\php.ini and add
      extension=php_pthreads.dll

Now restart server and you are done. Thanks.
up
25
Jimmy Christensen
1 year ago
On Windows the installation is as follows:

Download the pthreads that matches your php version.
I found mine at: http://windows.php.net/downloads/pecl/releases/pthreads/
(I used version 0.44 wich is the newest at the time of writing this, and then downloaded the one for php 5.3 which is the version I am using).

Extract the zip.
Move php_pthreads.dll to the php\ext\ directory.
Move pthreadVC2.dll to the php\ directory.

Open php\php.ini and add
extension=php_pthreads.dll

You are done.
up
9
matias dot zumbo at gmail dot com
1 year ago
HOW TO INSTALL IN LINUX SYSTEM'S:
------------------------------------

1) Download PHP sources and Unpack PHP

2) Download PEAR
     wget http://pear.php.net/go-pear.phar
     php go-pear.phar

3) Download pthreads
Get PECL extension (PECL is a repository for PHP Extensions)

# pecl install pthread-0.4.4

4) Unpack pthreads
copy pthread-0.4.4  to  php/ext
(for ./configure allow  add option --enable-pthreads)

# mv build/php-src-master/ext/pthreads-master    build/php-src-master/ext/pthreads

5)  Reconfigure sources
# ./buildconf --force
# ./configure --help | grep pthreads

You should see the appropriate --enable-pthreads option listed as a result, if you do not, then

# rm -rf aclocal.m4
# rm -rf autom4te.cache/
# ./buildconf --force

6) Build PHP
Compile PHP source code
Add:
# ./configure --enable-debug --enable-maintainer-zts --enable-pthreads

7) Installing PHP
# make
# sudo make install

8) Update php.ini
Add in php.ini
extension=pthreads.so
Include_path = “/usr/local/lib/php”

9) Check Modules
php -m (check pthread loaded)

10) Test Thread Class
# php SimpleTest.php
up
1
Pedro Proenca
6 months ago
I haven't found any proper instructions on how to install pthreads in linux, so I'll leave the steps I followed:

# Required libraries
sudo apt-get install gcc make libzzip-dev libreadline-dev libxml2-dev \
libssl-dev libmcrypt-dev libcurl4-openssl-dev lib32bz2-dev

# Download PHP
cd /usr/local/src

wget http://www.php.net/distributions/php-<version>.tar.gz
( e.g. wget http://www.php.net/distributions/php-5.5.8.tar.gz )

# Extract
tar zxvf php-<version>.tar.gz
(e.g. tar zxvf php-5.5.8.tar.gz )

# Configure
cd /usr/local/src/php-<version>
( e.g. cd /usr/local/src/php-5.5.8 )

./configure --prefix=/usr --with-config-file-path=/etc --enable-maintainer-zts

# Compile
make && make install
( make -j3 && make -j3 install) -> Faster building

# Copy configuration
cp php.ini-development /etc/php.ini

# Install pthreads
pecl install pthreads
echo "extension=pthreads.so" >> /etc/php.ini

# Check installation
php -m | grep pthreads
up
0
pedro dot proenca at shapedfor dot me
6 months ago
I haven't found any proper instructions on how to install pthreads in linux, so I'll leave the steps I followed:

# Required libraries
sudo apt-get install gcc make libzzip-dev libreadline-dev libxml2-dev \
libssl-dev libmcrypt-dev libcurl4-openssl-dev lib32bz2-dev

# Download PHP
cd /usr/local/src

wget http://www.php.net/distributions/php-<version>.tar.gz
( e.g. wget http://www.php.net/distributions/php-5.5.8.tar.gz )

# Extract
tar zxvf php-<version>.tar.gz
(e.g. tar zxvf php-5.5.8.tar.gz )

# Configure
cd /usr/local/src/php-<version>
( e.g. cd /usr/local/src/php-5.5.8 )

./configure --prefix=/usr --with-config-file-path=/etc --enable-maintainer-zts

# Compile
make && make install
( make -j3 && make -j3 install) -> Faster building

# Copy configuration
cp php.ini-development /etc/php.ini

# Install pthreads
pecl install pthreads
echo "extension=pthreads.so" >> /etc/php.ini

# Check installation
php -m | grep pthreads
up
-1
logi89in at gmail dot com
6 months ago
I have included the PThread library dll in PHP 5.3 directory.
And i also add an extension in my php.ini file.

But when i write a simple program. PHP process gets killed when creating a Thread class.

Can anyone guide me?
up
-5
rbfowler9lfc at hotmail dot com
1 year ago
For those using XAMPP or other apache-php bundles, it's necessary to add LoadFile "C:/xampp/php/pthreadVC2.dll" to httpd-xampp.conf if you want to utilize pthreads in a browser window.
up
-4
jason at jason-rush dot com
1 year ago
The files are in the format:
php_pthreads-X.XX-Y.Y-ts-vcZZ-x86.zip

where
X.XX is the version of the phpthreads-win32
Y.Y is the base version of PHP that you are running
ZZ is ?? (version of compiler?)

Currently, 0.44 is the latest release of phpthreads-win32, so X.XX = 0.44
If you are running PHP 5.3.13, then Y.Y = 5.3
If you are running PHP 5.5.0, then Y.Y=5.5
etc

php_pthreads-0.44-5.3-ts-vc9-x86.zip
php_pthreads-0.44-5.4-ts-vc9-x86.zip
php_pthreads-0.44-5.5-ts-vc11-x64.zip
php_pthreads-0.44-5.5-ts-vc11-x86.zip
up
-9
Prerna
1 year ago
Hi Jimmy Christensen,

As per the above guidelines, I tried the same procedure on my windows system ( 32 bit ) to install pThreads.
But unfortunately, the threads is still not supported.

Is there any other configuration / requirement to get it installed. My system PHP version is 5.3.13. So i downloaded the package "php_pthreads-0.44-5.4-ts-vc9-x86.zip" from http://windows.php.net/downloads/pecl/releases/pthreads/0.44/ .

Please let me know where i am going wrong?

Thanks in advance.
To Top