一.下载php-7.0.5
http://cn2.php.net/distributions/php-7.0.5.tar.gz

二.解压安装:
# tar zxvf php-7.0.5.tar.gz
# cd php-7.0.5
配置
#./configure --prefix=/usr/local/php7  --with-curl  --with-freetype-dir  --with-gd  --with-gettext  --with-iconv-dir  --with-kerberos  --with-libdir=lib64  --with-libxml-dir  --with-mysqli  --with-openssl  --with-pcre-regex  --with-pdo-mysql  --with-pdo-sqlite  --with-pear  --with-png-dir  --with-xmlrpc  --with-xsl  --with-zlib  --enable-fpm  --enable-bcmath  --enable-libxml  --enable-inline-optimization  --enable-gd-native-ttf  --enable-mbregex  --enable-mbstring  --enable-opcache  --enable-pcntl  --enable-shmop  --enable-soap  --enable-sockets  --enable-sysvsem  --enable-xml  --enable-zip

/*mysqlnd

./configure --prefix=/usr/local/php7  --with-curl  --with-freetype-dir  --with-gd  --with-gettext  --with-iconv-dir  --with-kerberos  --with-libdir=lib64  --with-libxml-dir  --with-mysqli=mysqlnd  --with-openssl  --with-pcre-regex  --with-pdo-mysql=mysqlnd  --with-pdo-sqlite  --with-pear  --with-png-dir  --with-xmlrpc  --with-xsl  --with-zlib  --enable-fpm  --enable-bcmath  --enable-libxml  --enable-inline-optimization  --enable-gd-native-ttf  --enable-mbregex  --enable-mbstring  --enable-opcache  --enable-pcntl  --enable-shmop  --enable-soap  --enable-sockets  --enable-sysvsem  --enable-xml  --enable-zip --enable-mysqlnd
*/

如果出现错误安装对应模块
# yum -y install libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel MySQL pcre-devel
# yum -y install curl-devel
# yum -y install libxslt-devel

三.安装
#make && make install

四.配置文件
# cp php.ini-development /usr/local/php7/lib/php.ini
# cp /usr/local/php7/etc/php-fpm.conf.default /usr/local/php7/etc/php-fpm.conf
# cp /usr/local/php7/etc/php-fpm.d/www.conf.default /usr/local/php7/etc/php-fpm.d/www.conf
# cp -R ./sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm

需要注意的是php7中www.conf这个配置文件配置phpfpm的端口号等信息,如果你修改默认的9000端口号需在这里改,再改nginx的配置启动
#  /etc/init.d/php-fpm

五.配置OPcache
官网地址:http://php.net/opcache
使用下列推荐设置来获得较好的 性能:
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.revalidate_freq=60
opcache.fast_shutdown=1
opcache.enable_cli=1
你也可以禁用 opcache.save_comments 并且启用 opcache.enable_file_override。 需要提醒的是,在生产环境中使用上述配置之前,必须经过严格测试。 因为上述配置存在一个已知问题,它会引发一些框架和应用的异常, 尤其是在存在文档使用了备注注解的时候。

#vi /usr/local/php7/etc/php.ini
# 加入
zend_extension=/usr/local/php7/lib/php/extensions/no-debug-non-zts-20141001/opcache.so

重启
# killall php-fpm
#  /etc/init.d/php-fpm

六.在phpinfo中查看OPcache的状态

也可以使用gits上提供的代码直观查看
https://gist.github.com/ck-on/4959032

七,其它php7优化
1.HugePage
首先在系统中开启HugePages, 然后开启Opcache的huge_code_pages.
#sysctl vm.nr_hugepages=512

然后在php.ini中加入:
opcache.huge_code_pages=1

2.Opcache file cache
在php.ini中加入:
opcache.file_cache=/tmp

参考网址:

http://blog.csdn.net/21aspnet/article/details/47708763

php7安装及配置的更多相关文章

  1. ubuntu下php7安装及配置

    直接用apt-get 失败 在官网下安装包http://tw2.php.net/get/php-7.0.18.tar.bz2/from/a/mirror 进行make时 出现错误: libtool: ...

  2. PHP7+Nginx的配置与安装教程详解

    下面脚本之家小编把PHP7+Nginx的配置与安装教程分享给大家,供大家参考,本文写的不好还请见谅. 系统环境:centos6.5 x64 软件版本:nginx-1.10.0 php-7.0.6 安装 ...

  3. PHP7安装笔记

    PHP7安装笔记 时间 -- :: 喵了个咪 原文 http://www.hdj.me/php7-install-note 主题 PHP # 安装mcrypt yum install -y php-m ...

  4. centos系统中php7安装memcached 扩展

    #编译安装php-7.1.16 #wget http://cn2.php.net/distributions/php-7.1.16.tar.gz#tar -zxvf php-7.1.16.tar.gz ...

  5. ubuntu16.04下zabbix安装和配置

    介绍 Zabbix是用于网络和应用的开源监控软件. 它提供从服务器,虚拟机和任何其他类型的网络设备收集的数千个度量的实时监控. 这些指标可以帮助您确定IT基础架构的当前运行状况,并在客户投诉之前检测硬 ...

  6. Apache+php安装和配置 windows

    Apache+php安装和配置 windows Apache 安装 1.官网网址:http://httpd.apache.org/ 2.Download 3.点击链接Files for Microso ...

  7. windows下php7安装redis扩展

    windows下php7安装redis扩展windows下开发用的wamp集成的环境,想装个php-redis扩展.php_redis.dll下载地址:https://pecl.php.net/pac ...

  8. Centos 7 手把手教你使用YUM方式安装并配置Nginx+php7-fpm+MySQL

    需要准备的内容 一台纯净系统的服务器 远程连接服务器的工具 (我这里使用Xshell) 安装nginx 链接上服务器后执行 yum install nginx  这里需要输入y 后回车,开始安装ngi ...

  9. Apache2.4.34 + php 7.28 + MySQL8.0.12 安装及配置

    服务端的学习 Apache2.4.34 的安装及配置 1.基本安装 最新的 Apache 已经不提供 Windows 的安装版本,所以我们这里使用的是解压版 -下载地址:https://www.apa ...

随机推荐

  1. [bzoj4424]Fairy

    很久之前想写这题.结果还是把握不住CF的E,太神了啊....... 首先考虑的是二分图的性质,这个so easy,图中不存在奇数环. 然后分三种情况考虑: 1.只有一个奇数环,随便删除哪条 2.多个奇 ...

  2. http://www.cnblogs.com/baizhanshi/p/5593431.html

    http://www.cnblogs.com/baizhanshi/p/5593431.html

  3. MySql 查询数据库中所有表名

    查询数据库中所有表名select table_name from information_schema.tables where table_schema='csdb' and table_type= ...

  4. CF# Educational Codeforces Round 3 E. Minimum spanning tree for each edge

    E. Minimum spanning tree for each edge time limit per test 2 seconds memory limit per test 256 megab ...

  5. BZOJ3692 : 愚蠢的算法

    两个函数相同等价于不存在长度为$3$的下降子序列. 先考虑随意填的部分,设$f[i][j]$表示考虑了$[i,n]$,下降子序列第$2$项的最小值的是这里面第$j$个的方案数,转移则考虑往序列里插数字 ...

  6. BZOJ4110 : [Wf2015]Evolution in Parallel

    首先每个串都必须是$S$的子序列,否则无解. 按长度从小到大依次考虑每个串,如果它两边都不能放,那么无解. 如果能放一边,那么放进去,把待定的全部放入另一边. 如果两边都能放,那么看看能否待定,如果不 ...

  7. .htaccess 的写法

    RewriteCond RewriteRule 记录下现在我会的: RewriteEngine On#RewriteRule ^(.*)/(.*)/$ index.php?m=index&c= ...

  8. [转]redis-cluster研究和使用--待研究

    转自:http://hot66hot.iteye.com/blog/2050676 一:关于redis cluster 1:redis cluster的现状 reids-cluster计划在redis ...

  9. BZOJ 1412 & 最小割

    什么时候ZJ省选再现一次这么良心的题吧... 题意: 在一个染色的格子画分割线,使其不想连,求最少的线段 SOL: 裸裸的最小割.题目要求两种颜色不想连,我们把他分到两个集合,也就是把所有相连的边切断 ...

  10. 洛谷 P1198 [JSOI2008]最大数 Label:线段树

    题目描述 现在请求你维护一个数列,要求提供以下两种操作: 1. 查询操作. 语法:Q L 功能:查询当前数列中末尾L个数中的最大的数,并输出这个数的值. 限制:L不超过当前数列的长度. 2. 插入操作 ...