1 安装php7
使用线程安全的配置 --enable-maintainer-zts
重新编译的时候如果报错,则执行make clean
2 安装libevent库 并且 yum install libevent-dev libevent-dev提供了开发的头文件
# 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
网友评论