[plain]
#If your autoconfig version is higher than 2.59, you can only install php5.4
# Otherwise you can only install 5.3.17. If you know the version of your autoconf - if you have installed php.5.4, then install it according to the installation of 5.4; if you have installed 5.3, install 5.3
#5.4
wget
tar zxvf php-5.4.7.tar.gz
cd php-5.4.7/ext
#5.3
wget
tar -xf php-5.3.17.tar.gz
cd php-5.3.17/ext
#install pthreads below
wget https://github.com/krakjoe/pthreads/tarball/master -O pthreads.tar.gz
tar -xf pthreads.tar.gz
mv krakjoe-pthreads* pthreads
cd ../
./buildconf --force
./configure --enable-maintainer-zts --enable-pthreads --prefix=/usr/local/php-threads#Configure other parameters by yourself, here are only the necessary parameters
make
make install
There are examples in the source code package, execute like this:
/usr/local/php-threads/bin/php AdvancedSynchronization.php
[plain]
Process: running
ScopeTest: 140703850592000 running
ScopeTest2: 140703839512320 running
ScopeTest2: 140703839512320 working ...
ScopeTest2: 140703839512320 notified: 1
Process: notifying 140703839512320: 1
ScopeTest: 140703850592000 notified: 1
Process: notifying 140703850592000: 1
I haven’t tried executing it through apache, because I don’t want to destroy the existing php environment, and I don’t plan to execute it in non-cli mode.