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

时间:2021-07-21 16:15:34

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. Windows Phone Toolkit 的 DatePicker 控件本地化的问题

    用到 The Windows Phone Toolkit 里的 DatePicker 控件,但是多语言的时候出现了问题: 手机设置为中文,虽然月份跟星期有效,但是 Title 却还是默认的语言:CHO ...

  2. [Data Structure & Algorithm] Hash那点事儿

    哈希表(Hash Table)是一种特殊的数据结构,它最大的特点就是可以快速实现查找.插入和删除.因为它独有的特点,Hash表经常被用来解决大数据问题,也因此被广大的程序员所青睐.为了能够更加灵活地使 ...

  3. display:none与visibility:hidden区别

    display:none与visibility:hidden有一个共同的作用是隐藏要显示的内容isplay:none 隐藏,但是不占空间 “看不见摸不到” 加载 display:none 隐藏,但是不 ...

  4. 火车头wordpress免费万能发布模块和接口

    火车头wordpress免费万能发布模块和接口实测可以用 http://www.ggfenxiang8.com/?p=263

  5. vbox安装mac os x

    http://zhiwei.li/text/2013/12/%E5%9C%A8virtualbox4-3-4%E4%B8%AD%E5%AE%89%E8%A3%85mavericks/ http://g ...

  6. C# 经典入门12章-System.Collections.Generic命名空间

    aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAtUAAAAsCAIAAAAl09PEAAAgAElEQVR4nOx95Vscyd7285cMPrg7Aw ...

  7. git配置全局用户名

    点击右键 ,点击git bash here 在控制面板输入 git config --global user.name "xxx" git config --global user ...

  8. Neutron 网络基本概念

    Neutron 网络基本概念 上次我们讨论了 Neutron 提供的功能,今天我们学习 Neutron 模块几个重要的概念. Neutron 管理的网络资源包括 Network,subnet 和 po ...

  9. qt多线程信号槽传输方式

    //简单介绍一下QT信号与槽的连接方式:    //Qt::AutoConnection表示系统自动选择相应的连接方式,如果信号与槽在同一线程,就采用Qt::DirectConnection, //如 ...

  10. MySQL-开发规范升级版

    一.基础规范 表存储引擎必须使用InnoDB   表字符集默认使用utf8,必要时候使用utf8mb4 解读: (1)通用,无乱码风险,汉字3字节,英文1字节 (2)utf8mb4是utf8的超集,有 ...