centos7下编译安装php-7.0.15(PHP-FPM)

一、下载php7源码包

http://php.net/downloads.php

如:php-7.0.15.tar.gz

二、安装所需依赖

> yum -y install gd-devel zlib-devel libjpeg-devel libpng-devel libiconv-devel freetype-devel libxml2 libxml2-devel openssl openssl-devel curl-devel libxslt-devel libmcrypt-devel mhash mcrypt

如果无法安装libiconv,请手动下载安装

http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
> tar xf libiconv-1.14.tar.gz
> cd libiconv-1.14
> ./configure --prefix=/usr/local/libiconv
> make && make install

如果出现如下问题,说明你系统版本较高。
./stdio.h:1010:1: 错误:‘gets’未声明(不在函数内)

> cd srclib/
> sed -i -e '/gets is a security/d' ./stdio.in.h
> cd ../
> make && make install

如果安装libmcrypt-devel、mhash、mcrypt出错,则重新配置yum源。

http://mirrors.163.com/.help/centos.html
http://mirrors.aliyun.com/help/centos

三、编译PHP
创建账号

> useradd -s /sbin/nologin -M nginx
> tar xf php-7.0.15.tar.gz
> cd /data/php-7.0.15
> ./configure --prefix=/data/php7 \
--with-openssl \
--with-pcre-regex \
--with-kerberos \
--with-libdir=lib \
--with-libxml-dir \
--with-mysqli=shared,mysqlnd \
--with-pdo-mysql=shared,mysqlnd \
--with-pdo-sqlite \
--with-gd \
--with-iconv \
--with-zlib \
--with-xmlrpc \
--with-xsl \
--with-pear \
--with-gettext \
--with-curl \
--with-png-dir \
--with-jpeg-dir \
--with-freetype-dir \
--with-fpm-user=nginx \
--with-fpm-group=nginx \
--enable-mysqlnd \
--enable-zip \
--enable-inline-optimization \
--enable-shared \
--enable-libxml \
--enable-xml \
--enable-bcmath \
--enable-shmop \
--enable-sysvsem \
--enable-mbregex \
--enable-mbstring \
--enable-ftp \
--enable-gd-native-ttf \
--enable-pcntl \
--enable-sockets \
--enable-soap \
--enable-session \
--enable-opcache \
--enable-fpm \
--enable-maintainer-zts \
--enable-fileinfo \

四、make && make install

> make && make install

五、配置文件

> cp /data/php-7.0.15/php.ini-development /data/php7/lib/php.ini
> cp -R /data/php-7.0.15/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
> cp /data/php7/etc/php-fpm.conf.default /data/php7/etc/php-fpm.conf
> cp /data/php7/etc/php-fpm.d/www.conf.default /data/php7/etc/php-fpm.d/www.conf

六、修改php.ini

> mkdir /data/php7/tmp
> chmod 766 /data/php7/tmp
extension_dir = "/data/php7/lib/php/extensions/no-debug-zts-20151012/"
session.save_path = "/data/php7/tmp"
date.timezone = PRC

七、添加环境变量

> echo 'export PATH=/data/php7/bin:/data/php7/sbin:$PATH' >> /etc/profile
> source /etc/profile

八、添加自启动

> chkconfig --add php-fpm
> chkconfig php-fpm on
> chkconfig --list php-fpm

九、启动服务

> chmod 755 /etc/init.d/php-fpm
> service php-fpm start
> ps -ef|grep php-fpm

十、php-fpm重启
php-fpm的pid文件默认在你php安装目录下var/run/php-fpm.pid

当然这是可以更改的,在/data/php7/etc/php-fpm.conf文件中

关闭

> kill -INT `cat /data/php7/var/run/php-fpm.pid`

重启

> kill -USR2 `cat /data/php7/var/run/php-fpm.pid`

centos7下编译安装php-7.0.15(PHP-FPM)的更多相关文章

  1. centos7下编译安装nginx-1.16.0

    一.下载nginx源码 http://nginx.org/en/download.html 如:nginx-1.16.0.tar.gz 二.创建用户和组,并解压 groupadd www userad ...

  2. CentOS7下编译安装redis-5.0.9

    CentOS7下编译安装redis-5.0.9 本文地址http://yangjianyong.cn/?p=171转载无需经过作者本人授权 下载redis #code start wget https ...

  3. 在CUDA8.0下编译安装OpenCV3.1.0来实现GPU加速(Compiling OpenCV3.1.0 with CUDA8.0 support)

    在CUDA8.0下编译安装OpenCV3.1.0 一.本人电脑配置:ubuntu 14.04, NVIDIA GTX1060. 二.编译OpenCV3.1.0前,读者需要成功安装CUDA8.0(网上有 ...

  4. Ubuntu16.04下编译安装OpenCV3.4.0(C++ & python)

    Ubuntu16.04下编译安装OpenCV3.4.0(C++ & python) 前提是已经安装了python2,python3 1)安装各种依赖库 sudo apt-get update ...

  5. centos7下编译安装redis5.05

    准备环境: 1.一台centos7机器,配置没有什么要求(能联网) 2.下载好redis压缩包 下载redis包: 1.登录redis官网: https://redis.io/download 2.选 ...

  6. OSX下编译安装opencv3.1.0与opencv_contrib_master

    OSX版本10.11.3 1.安装homebrew,打开终端,写入指令 ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Hom ...

  7. CentOS7 下编译安装 Samba,什么是 SMB/CIFS 协议

    目录 一.关于 Samba 1. SMB 2. Samba 二.yum 安装 Samba 1. 安装 Samba 2. 查看版本 3. 查看配置文件 4. 启动服务 5. 本地客户端验证 6. Win ...

  8. centos7下编译安装php7.3

    一.下载php7.3的源码 https://www.php.net/downloads.php 下载php-7.3.4.tar.gz 二.安装gcc,gcc-c++,kernel-devel yum ...

  9. Centos6下编译安装gcc6.4.0

    Centos6自带的gcc4.4.7不支持c++11, 于是编译安装最新版的gcc wget https://gmplib.org/download/gmp/gmp-6.1.2.tar.xz .tar ...

随机推荐

  1. jQuery的get()用法

    这个方法主要是将jQuery对象或者jQuery对象集合转换成DOM对象或dom对象集合. get()方法中如果传递参数,表示将具体位置的jQuery对象转换成dom对象.如果没有参数,则表示返回所有 ...

  2. 给iOS开发新手送点福利,简述UIDatePicker的用法

    1.Locale 设置DatePicker的地区,即设置DatePicker显示的语言. 1.跟踪所有可用的地区,取出想要的地区 NSLog(@"%@", [NSLocale av ...

  3. Swift里的CAP理论和NWR策略应用

    http://blog.sina.com.cn/s/blog_57f61b490101a8ca.html 最近有人讨论到swift副本数是否能够调整,3副本成本过高,如果改成2副本怎么样?多聊了几句以 ...

  4. hive数据导入导出和常用操作

    导出到本地文件 insert overwrite local directory '/home/hadoop'select * from test1; 导出到hdfs insert overwrite ...

  5. node实现缓存

    内容: 1.缓存基本原理 2.node实现缓存 1.缓存基本原理 第一重要.缓存策略: cache-control:用于控制缓存,常见的取值有private.no-cache.max-age.must ...

  6. ATM+购物商城

    知识内容: 1.luffy买tesla 2.ATM+购物商城 一.luffy买tesla 需求: 1.目录结构说明 account luffy.json --> 存储用户账户信息 {" ...

  7. TortoiseGit上传项目到GitHub

    1. 简介 gitHub是一个面向开源及私有软件项目的托管平台,因为只支持git 作为唯一的版本库格式进行托管,故名gitHub. 2. 准备 2.1  安装git:https://git-scm.c ...

  8. Spring_JAP_CXF_maven

    发送 pom,xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://ww ...

  9. 从Chrome 69.0 版本起,Flash权限受到进一步限制,默认仅在当前浏览器会话有效。

    # 69.0 之后的版本 ## 从Chrome 69.0 版本起,Flash权限受到进一步限制,默认仅在当前浏览器会话有效.关闭Enable Ephemeral Flash Permissions , ...

  10. leetcode268

    public class Solution { public int MissingNumber(int[] nums) { var list = nums.OrderBy(x => x).To ...