zoukankan      html  css  js  c++  java
  • Centos7 PHP7 编译安装 开机自启动

    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.13.tar.gz

    3、 进入目录  

    cd php-7.0.13

    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
  • 相关阅读:
    SAP S/4HANA extensibility扩展原理介绍
    SAP CRM系统订单模型的设计与实现
    使用nodejs代码在SAP C4C里创建Individual customer
    SAP Cloud for Customer Account和individual customer的区别
    Let the Balloon Rise map一个数组
    How Many Tables 简单并查集
    Heap Operations 优先队列
    Arpa’s obvious problem and Mehrdad’s terrible solution 思维
    Passing the Message 单调栈两次
    The Suspects 并查集
  • 原文地址:https://www.cnblogs.com/onephp/p/6093707.html
Copyright © 2011-2022 走看看