1、PHP7.0.13下载

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

2、解压

  1. tar -zxvf php-7.0..tar.gz

3、 进入目录

  1. cd php-7.0.

4、下载扩展库

  1. yum -y install libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel MySQL pcre-devel
  2. yum -y install curl-devel
  3. yum -y install libxslt-devel

5、编译安装

  1. ./configure --prefix=/usr/local/php7 \
  2. --with-curl \
  3. --with-freetype-dir \
  4. --with-gd \
    --with-jpeg-dir \
  5. --with-gettext \
  6. --with-iconv-dir \
  7. --with-kerberos \
  8. --with-libdir=lib64 \
  9. --with-libxml-dir \
  10. --with-mysqli \
  11. --with-openssl \
  12. --with-pcre-regex \
  13. --with-pdo-mysql \
  14. --with-pdo-sqlite \
  15. --with-pear \
  16. --with-png-dir \
  17. --with-xmlrpc \
  18. --with-xsl \
  19. --with-zlib \
  20. --enable-fpm \
  21. --enable-bcmath \
  22. --enable-libxml \
  23. --enable-inline-optimization \
  24. --enable-gd-native-ttf \
  25. --enable-mbregex \
  26. --enable-mbstring \
  27. --enable-opcache \
  28. --enable-pcntl \
  29. --enable-shmop \
  30. --enable-soap \
  31. --enable-sockets \
  32. --enable-sysvsem \
  33. --enable-xml \
  34. --enable-zip
  1. make && make install

6、拷贝配置文件

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

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

  1. vim /usr/local/php7/etc/php-fpm.conf
  1. 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 默认可不改

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

7、添加服务

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

内容如下

  1. [Unit]
  2. Description=The PHP FastCGI Process Manager
  3. After=syslog.target network.target
  4.  
  5. [Service]
  6. Type=simple
  7. PIDFile=/run/php-fpm.pid
  8. ExecStart=/usr/local/php7/sbin/php-fpm --nodaemonize --fpm-config /usr/local/php7/etc/php-fpm.conf
  9. ExecReload=/bin/kill -USR2 $MAINPID
  10. ExecStop=/bin/kill -SIGINT $MAINPID
  11.  
  12. [Install]
  13. WantedBy=multi-user.target

8、启动php-fpm

  1. systemctl start php-fpm.service

9、添加到开机启动

  1. systemctl enable php-fpm.service
 
10、systemctl指令
  1. systemctl enable *.service #开机运行服务
  2. systemctl disable *.service #取消开机运行
  3. systemctl start *.service #启动服务
  4. systemctl stop *.service #停止服务
  5. systemctl restart *.service #重启服务
  6. systemctl reload *.service #重新加载服务配置文件
  7. systemctl status *.service #查询服务运行状态
  8. systemctl --failed #显示启动失败的服务
  9.  
  10. 修改 php.ini 文件 设置 expose_php = Off
  11. vim /usr/local/php7/etc/php.ini
  12. 找到 expose_php = On
  13. 改为 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.lang.IllegalThreadStateException

    java.lang.IllegalThreadStateException 今天遇到了这个问题.当时的情景是想要循环实现了runable的类和继承Thread类的两个线程.可是没有注意到,继承自Thr ...

  2. html的textarea控制字数小案例

    <h3>设计理念说明(200字以内)</h3> <textarea onkeyup="checkLen(this)"></textarea ...

  3. 多校3-Magician 分类: 比赛 2015-07-31 08:13 4人阅读 评论(0) 收藏

    Magician Time Limit: 18000/9000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total ...

  4. javascript学习(一) 异常处理与简单的事件

    一:异常处理 <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></ti ...

  5. ubuntu下查看cpu信息

    查看CPU信息cat /proc/cpuinfo 几个cpu more /proc/cpuinfo |grep "physical id"|uniq|wc -l 每个cpu是几核( ...

  6. SQL锁行 解决多台服务器发送统一请求并发问题

    锁行信息SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED 存储过程:SET Transaction Isolation Level Read语法的四种情 ...

  7. HTTP 错误 404.2 - Not Found

    前几天刚安装Windows Server 2008 r2 sp1 遇到问题之后,昨天我又遇到一个问题(但我不害怕有问题),提示: HTTP 错误 404.2 - Not Found由于 Web 服务器 ...

  8. 2016CCPC东北地区大学生程序设计竞赛 1008 HDU5929

    链接http://acm.hdu.edu.cn/showproblem.php?pid=5929 题意:给你一种数据结构以及操作,和一种位运算,最后询问:从'栈'顶到低的运算顺序结果是多少 解法:根据 ...

  9. 公共控件Listview

    ListView属性中,Items是行的总集合,Items集合中的每一个是一行,Items集合里面有ListViewItem集合,这个集合实例化:ListViewItem li=new ListVie ...

  10. Java IO流整理Rick

    Java 流IO部分: Console 控制台信息读取// ----------- Console Begin // ------------ 部分代码  Console cons ;  char[] ...