1、PHP7.0.13下载

wget http://cn2.php.net/get/php-7.0.13.tar.gz/from/this/mirror

2、解压

tar -zxvf php-7.0..tar.gz

3、 进入目录

cd php-7.0.

4、下载扩展库

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

5、编译安装

./configure --prefix=/usr/local/php7 \
--with-curl \
--with-freetype-dir \
--with-gd \
--with-jpeg-dir \
--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
make &&  make install

6、拷贝配置文件

cp php.ini-production /usr/local/php7/lib/php.ini
vim /usr/local/php7/lib/php.ini
cp /usr/local/php7/etc/php-fpm.conf.default /usr/local/php7/etc/php-fpm.conf

#把pid 改成 /run/php-fpm.pid

vim /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

#listen = 127.0.0.1:9000 默认可不改

vim /usr/local/php7/etc/php-fpm.d/www.conf 

7、添加服务

vim /etc/systemd/system/php-fpm.service

内容如下

[Unit]
Description=The PHP FastCGI Process Manager
After=syslog.target network.target [Service]
Type=simple
PIDFile=/run/php-fpm.pid
ExecStart=/usr/local/php7/sbin/php-fpm --nodaemonize --fpm-config /usr/local/php7/etc/php-fpm.conf
ExecReload=/bin/kill -USR2 $MAINPID
ExecStop=/bin/kill -SIGINT $MAINPID [Install]
WantedBy=multi-user.target

8、启动php-fpm

systemctl start php-fpm.service

9、添加到开机启动

systemctl enable php-fpm.service
 
10、systemctl指令
systemctl enable *.service #开机运行服务
systemctl disable *.service #取消开机运行
systemctl start *.service #启动服务
systemctl stop *.service #停止服务
systemctl restart *.service #重启服务
systemctl reload *.service #重新加载服务配置文件
systemctl status *.service #查询服务运行状态
systemctl --failed #显示启动失败的服务 修改 php.ini 文件 设置 expose_php = Off
vim /usr/local/php7/etc/php.ini
找到 expose_php = On
改为 expose_php = Off

Centos7 PHP7 编译安装 开机自启动的更多相关文章

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

    centos7下编译安装php-7.0.15(PHP-FPM) 一.下载php7源码包 http://php.net/downloads.php 如:php-7.0.15.tar.gz 二.安装所需依 ...

  2. centos7.6编译安装php7.2.11及redis/memcached/rabbitmq/openssl/curl等常见扩展

    centos7.6编译安装php7..11及redis/memcached/rabbitmq/openssl/curl等常见扩展 获取Php的编译参数方法: [root@eus-api-cms-bac ...

  3. Linux Centos7.2 编译安装PHP7.0.2

    操作环境: 1.系统:Centos7.2 2.服务:Nginx 1.下载PHP7.0.2的安装包解压,编译,安装: $ cd /usr/src/ $ wget http://cn2.php.net/d ...

  4. CentOS7中设置Tomcat8开机自启动

    CentOS7中设置Tomcat8开机自启动 本文介绍了在centos7中配置tomcat的开机自启动的一些操作步骤,仅供参考. 环境是CentOS 7 ,jdk版本是1.8.0_191,tomcat ...

  5. CentOS7下编译安装redis-5.0.9

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

  6. CentOS7.6编译安装openssl-1.1.1c

    卸载旧版本OpenSSL # which openssl/usr/bin/openssl# mv openssl openssl.oldrm -rf /etc/ssl #删除配置文件 CentOS7. ...

  7. CentOS7.6编译安装Python-3.7.4

    安装步骤 1. 下载安装包.wget https://www.python.org/ftp/python/3.7.4/Python-3.7.4.tgz<说明>如果报SSL/TSL错误,则加 ...

  8. Centos7.2 编译安装PHP7

    PHP7,编译安装: 环境:centos7.2    (注意:因为我用的nginx, 此配置参数没有考虑到apache,所以不合适需要用apache的朋友照搬过去运行,但是可以参考.)   直接下载P ...

  9. centos7下编译安装php7.3

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

随机推荐

  1. 【转】JAVA变量path , classpth ,java_home设设置作用和作用

    转载地址:http://bbs.tech.163.com/bbs/tech_0ik1/147645925.html 在把jdk安装到计算机中之后,我们来进行设置使java环境能够使用. 首先右键点我的 ...

  2. c#委托之最大

    public delegate int ceshi(object o1, object o2); static void Main(string[] args) { string[] a = { &q ...

  3. SQL-字符串合并

    create table tb(id int, value varchar(10))  insert into tb values(1, 'aa')  insert into tb values(1, ...

  4. N-gram介绍

    在实际应用中,我们经常需要解决这样一类问题:如何计算一个句子的概率?如: 机器翻译:P(high winds tonite) > P(large winds tonite) 拼写纠错:P(abo ...

  5. DLL数据共享在不同处定义效果不同..

    DLL头文件: #ifndef _DLL_SAMPLE_H #define _DLL_SAMPLE_H #pragma data_seg("ShareReadAndWrite") ...

  6. 抓取Js动态生成数据且以滚动页面方式分页的网页

    代码也可以从我的开源项目HtmlExtractor中获取. 当我们在进行数据抓取的时候,如果目标网站是以Js的方式动态生成数据且以滚动页面的方式进行分页,那么我们该如何抓取呢? 如类似今日头条这样的网 ...

  7. C++实现的屏幕截图软件 v1.0

    之前用win32做的屏幕截图软件,使用了好久,非常好用. 在2.0版本中增加了屏幕尺和颜色拾取功能,并且改用屏幕和内存DC双缓冲,彻底消灭了闪屏,可惜代码丢失了 好不容易找到1.0版本的代码,以后再重 ...

  8. Centos6.6 tar包安装JDK

    Linux CentOS 6.6安装JDK1.7 目录 1.下载JDK 2.卸载JDK 3.安装JDK 3.1..rpm后缀格式JDK安装方式 3.2..tar.gz后缀格式JDK安装方式 4.验证安 ...

  9. Listview的闪烁问题

    在更新Listview数据时会出现闪烁,主要原因是没有开启双缓冲属性,在C#中可以通过重载Listview的方式开启,代码如下: using System.Windows.Forms; public ...

  10. Application 应用程序对象使用介绍

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DemoApplicatio ...