[plain]
#如果你的autoconfig版本高於2.59,則只能安裝php5.4
#否則你只可以安裝5.3.17。如果知道你的autoconf的版本——如果你已經安裝了php.5.4那麼,你就安裝照5.4的安裝;如果裝了5.3就裝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
#下面裝pthreads
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#其它參數自行配置,這裡只是必須的參數
make
make install
源碼包裡面有例子,像這樣執行:
/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
通過apache執行的還沒有試過,因為我不想破壞現有的php環境,而且我也不打算在非cli模式下執行。