zoukankan      html  css  js  c++  java
  • php7安装及配置

    一.下载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

  • 相关阅读:
    C# MVC模式设置404&500
    jQuery实现滚动条滚动到子元素位置(方便定位)
    Oracle数据库的导出导入
    Oracle之clob字段不能union的问题
    div中内容垂直居中的方法小结
    C#实现Oracle数据库插入clob字段类型数据
    C_结构体_笔记
    Practice_17_01_ABC
    Practice_17_01_GID
    【转】 vim显示行号、语法高亮、自动缩进的设置
  • 原文地址:https://www.cnblogs.com/itfenqing/p/5427195.html
Copyright © 2011-2022 走看看