centos7 上 安装php5.6以及配置event扩展

在这里简单介绍一下安装php5.6的方法。
安装php5.6版本以后不再需要安装Zend Guard,而是用yum命令安装php-opcache及php-pecl-apcu就可以有效的提高php执行速度。
1. 配置yum源
事先确认yum源的链接是不是有效的。 yum install epel-release
# rpm -Uvh http://ftp.iij.ad.jp/pub/linux/fedora/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

2. 确认安装的php版本
# yum list --enablerepo=remi --enablerepo=remi-php56 | grep php

3. 安装php5.6
# yum install --enablerepo=remi --enablerepo=remi-php56 php php-opcache php-pecl-apcu php-devel php-mbstring php-mcrypt php-mysqlnd php-phpunit-PHPUnit php-pecl-xdebug php-pecl-xhprof php-pdo php-pear php-fpm php-cli php-xml php-bcmath php-process php-gd php-common

php-opcache及php-pecl-apcu会有效的提高php执行速度。
4. 确认php版本
# php -v
PHP 5.6.6 (cli) (built: Feb 19 2015 10:19:37)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2015, by Zend Technologies
with Xdebug v2.3.1, Copyright (c) 2002-2015, by Derick Rethans



安装php event扩展
参考:https://bitbucket.org/osmanov/pecl-event/src/e2369dac708c910c43b7b7e55a4219ddc3f53896/INSTALL.md?fileviewer=file-view-default

#安装编译环境
yum install gcc g++
yum install libevent-dev
安装remi扩展源请参考安装php 5.6
yum install --enablerepo=remi libevent libevent-devel
yum install --enablerepo=remi openssl openssl-devel

#下载扩展,手动编译安装
wget -c https://pecl.php.net/get/event-2.1.0.tgz
tar -zxvf *.tar.gz
cp package.xml event*

#安装
pecl install package.xml

#配置PHP
在 /etc/php.d/ 中增加event的配置文件