1 安裝php7
使用線程安全的配置 --enable-maintainer-zts
重新編譯的時候如果報錯,則執(zhí)行make clean
2 安裝libevent庫 并且 yum install libevent-dev libevent-dev提供了開發(fā)的頭文件
# cd /tmp
# wget http://www.monkey.org/~provos/libevent-1.2.tar.gz
# tar zxvf libevent-1.2.tar.gz
# cd libevent-1.2
# ./configure –prefix=/usr
# make
# make install
3 安裝event擴展 ,
http://pecl.php.net/package/event
wget -O event-2.4.1.tgz http://pecl.php.net/get/event-2.4.1.tgz
在zts模式下,安裝2.4.0成功,安裝2.4.1失敗。
wget -O event-2.4.0.tgz http://pecl.php.net/get/event-2.4.0.tgz
tar -xvf event-2.4.1.tgz
phpize
./configure --with-php-config=/apps/php/bin/php-config --with-event-libevent-dir=/usr/
make && make install
在php.ini添加下面配置
extension=event.so
4 安裝php libevent擴展 (取消該步驟,可用于php5.6,libevent擴展沒人維護了,PHP下不要安裝了。)
從 http://pecl.php.net/package/libevent http://pecl.php.net/get/libevent-0.1.0.tgz
tar zxvf libevent-0.1.0.tgz
cd libevent-0.1.0
phpize
./configure --with-php-config=/apps/php/bin/php-config
如果報錯:Cannot find autoconf
安裝autoconf
wget http://ftp.gnu.org/gnu/m4/m4-1.4.9.tar.gz
tar -zvxf m4-1.4.9.tar.gz
cd m4-1.4.9/
./configure && make && make install
cd ../
wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.62.tar.gz
tar -zvxf autoconf-2.62.tar.gz
cd autoconf-2.62/
./configure && make && make install
如果安裝autoconf的過程中報錯:(Can't locate Data/Dumper.pm in @INC (@INC contains: ../lib /usr/local/lib64/perl5)
用yum 安裝perl
yum install 'perl(Data::Dumper)'
再次安裝autoconf
再次安裝libevent擴展
./configure --with-php-config=/apps/php/bin/php-config --with-libevent=/usr/
5 安裝 pthreads
github去下載pthreads的3.1版本
pthreads/tree/v3.1.0 支持php7+
- cd pthreads
- phpize
- ./configure
- make
- make install (may need sudo)
- Update your php.ini file to load the pthreads.so file using the extension directive