一.下载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. js小例子(标签页)

    运用js写的一个小例子,实现点击不同的标签出现不同的内容: <!DOCTYPE html> <html> <head> <meta chaset=" ...

  2. 实现点击不同的按钮加载不同的css

    这段时间做一个小网站发现有时候特别需要点击不同的按钮去加载不同的css,这样可以确定点击的是哪个,由于每个按钮都是从后端数据库加载过来的,不仅是简简单单的用id或者是类名,用过this也不行: 前端加 ...

  3. SSH建立连接的过程

    1.     服务器建立公钥档: 每一次启动 sshd 服务时,该服务会主动去找 /etc/ssh/ssh_host* 的档案,若刚刚安装完ssh软件时,由于没有这些公钥档案,通过/etc/init. ...

  4. C#获取IP地址

    public string GetUserIP()   {        string _userIP;       if(Request.ServerVariables["HTTP_VIA ...

  5. OpenCV 线性混合(4)

      带滚动条的线性混合示例:   #include "stdafx.h" #include<iostream> #include<thread> #incl ...

  6. 斑点检测(LoG,DoG) [上]

    斑点检测(LoG,DoG) [上] 维基百科,LoG,DoG,DoH 在计算机视觉中,斑点检测是指在数字图像中找出和周围区域特性不同的区域,这些特性包括光照或颜色等.一般图像中斑点区域的像素特性相似甚 ...

  7. hadoop yarn running beyond physical memory used

    老是报物理内存越界,kill container,然后把yarn.scheduler.minimum-allocation-mb设成2048就好了 跟这个yarn.nodemanager.pmem-c ...

  8. NOIp 2013 #2 花匠 Label:爆0的Water

    题目描述 花匠栋栋种了一排花,每株花都有自己的高度.花儿越长越大,也越来越挤.栋栋决定 把这排中的一部分花移走,将剩下的留在原地,使得剩下的花能有空间长大,同时,栋栋希 望剩下的花排列得比较别致. 具 ...

  9. scrollIntoView

    DOM的滚动 DOM规范中并没有规定各浏览器需要实现怎样的滚动页面区域,各浏览器实现了相应的方法,可以使用不同的方式控制页面区域的滚动.这些方法作为HTMLElement类型的扩展存在,所以它能在所有 ...

  10. [深入浅出Windows 10]布局原理

    5.2 布局原理 很多时候在编写程序界面的时候都会忽略了应用布局的重要性,仅仅只是把布局看作是对UI元素的排列,只要能实现布局的效果就可以了,但是在实际的产品开发中这是远远不够的,你可能面临要实现的布 ...