centos下部署php7

59store erp环境标准化

1.why to be standard

分析概括前几个月来发布过程中遇到的问题,dev,qa,stage,product 4个环境配置并不是都同样,致使php

内网测试各环境经过但在生产环境仍是会跪,未永绝后患,故联合悟饭整理一个erp的标准php环境,整理mysql

完通过测试后,将dev,qa,stage,product环境所有统一。laravel

2.PHP版本选择(7.0)

为什么选择php7

  • php之父曰:能比前一版PHP 5快上一倍sql

  • 团队使用laravel框架对高版本PHP兼容性友好api

  • 你们能够使用PHP7新特性,有助于咱们跟上节奏php7

PHP(7.0)在CentOs下的安装

1.下载

wget -O php-7.0.5.tar.gz http://cn2.php.net/get/php-7.0.5.tar.gz/from/this/mirror框架

2.安装开发包和依赖库

  • 安装development toolscurl

    `yum groupinstall development tools`
  • 安装yum扩展socket

    1.`rpm -ivh http://mirrors.sohu.com/fedora-epel/6/i386/epel-release-6-8.noarch.rpm`
    
    2.`yum update`
  • 安装PHP支持库php-fpm

    yum -y install libmcrypt-devel mhash-devel libxslt-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel php-mcrypt

3.编译PHP7.0

  • 编译参数

    './configure'  '--prefix=/usr/local/php' '--with-config-file-path=/usr/local/php/etc' '--enable-fpm' '--with-fpm-user=www' '--with-fpm-group=www' '--with-mysql=mysqlnd' '--with-mysqli=mysqlnd' '--with-pdo-mysql=mysqlnd' '--with-iconv-dir' '--with-freetype-dir=/usr/local/freetype' '--with-jpeg-dir' '--with-png-dir' '--with-zlib' '--with-libxml-dir=/usr' '--enable-xml' '--disable-rpath' '--enable-bcmath' '--enable-shmop' '--enable-sysvsem' '--enable-inline-optimization' '--with-curl' '--enable-mbregex' '--enable-mbstring' '--with-mcrypt' '--enable-ftp' '--with-gd' '--enable-gd-native-ttf' '--with-openssl' '--with-mhash' '--enable-pcntl' '--enable-sockets' '--with-xmlrpc' '--enable-zip' '--enable-soap' '--with-gettext' '--disable-fileinfo' '--enable-opcache'
  • make && make install

make && make install

4.配置PHP-FPM

  • 增长用户&用户组

    1. groupadd www

    2. useradd -g www www

  • 拷贝php-fpm.conf文件
    cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf

  • 拷贝php-fpm include文件
    cp usr/local/php/etc/php-fpm.d/ww.conf.default www.conf

  • 拷贝php.ini
    cp php.ini-production /usr/local/php/etc/php.ini

5.将php加入环境变量

1.vi /etc/profile

2.PATH=$PATH:/usr/local/php/bin

3.export PATH

4.source /etc/profile

6.php-fpm自启动

  • 1.拷贝
    cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm

  • 加入系统启动项

    chkconfig php-fpm on

7.重启php

  • service php-fpm restart

相关文章
相关标签/搜索