首页 > 系统相关 >Alibaba Cloud Linux 3.2104 LTS 安装php-5.6.12

Alibaba Cloud Linux 3.2104 LTS 安装php-5.6.12

时间:2024-04-18 17:22:49浏览次数:27  
标签:LTS 12 5.6 fpm -- usr php local php5.6

1 把php安装包上传到服务器
2 安装php所需要的扩展
 yum -y install libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel curl curl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libmcrypt libmcrypt-devel  gd gd-devel 
3 安装php
  tar -jxvf php-5.6.12.tar.bz2
  cd php-5.6.12
  ./configure --prefix=/usr/local/php5.6 --enable-shared --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-libxml-dir  --with-curl --with-zlib-dir -with-gettext --with-jpeg-dir --with-png-dir --with-bz2 --with-freetype-dir --with-iconv --with-config-file-path=/usr/local/php5.6/etc --enable-mbstring --with-gd --disable-debug --enable-short-tags --disable-posix --enable-exif --enable-ftp --enable-sockets --with-mhash --enable-zip --enable-opcache --enable-inline-optimization

  make
  make install
 
  cp php.ini-production /usr/local/php5.6/etc/php.ini
4 更改php配置文件

编辑 php.ini文件  设置如下
 
short_open_tag = On
 
disable_functions = "dl,exec,passthru,pcntl_exec,popen,posix_kill,posix_mkfifo,posix_setuid,proc_close,proc_open,proc_terminate,shell_exec,system,leak,posix_setpgid,posix_setsid,proc_get_status,proc_nice,show_source"
 
cgi.fix_pathinfo=0
 
date.timezone = Asia/Shanghai
expose_php = Off
5 编辑php-fpm配置文件
  
   cp php-fpm.conf.default  php-fpm.conf
  
  编辑  php-fpm.conf  设置如下
 
  pid = /usr/local/php5.6/var/run/php-fpm.pid
   
  error_log = log/php-fpm.log
 
  log_level = notice
   
   process_control_timeout = 30
 
  events.mechanism = epoll
 
  listen = 127.0.0.1:9056
   
   listen.backlog = -1
   
   pm.max_children = 1024
 
    pm.start_servers = 80
    
    pm.min_spare_servers = 20
 
    pm.max_spare_servers = 80
 
    pm.max_requests = 2000
 
    pm.status_path = /status
 
    ping.path = /ping
    
    ping.response = pong
 
    slowlog =  var/log/phpslow_$pool.log
 
    request_slowlog_timeout = 5s
    
    request_terminate_timeout = 60s
 
     rlimit_files = 65534
 
    php_admin_value[open_basedir] = "/tmp/"
php_admin_value[disable_functions] = dl,exec,leak,passthru,pcntl_exec,popen,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,show_source,system
6 测试
  
  #测试php-fpm配置
/usr/local/php5.6/sbin/php-fpm -t
/usr/local/php5.6/sbin/php-fpm -c /usr/local/php5.6/etc/php.ini -y /usr/local/php5.6/etc/php-fpm.conf -t
 
#启动php-fpm
/usr/local/php5.6/sbin/php-fpm
/usr/local/php5.6/sbin/php-fpm -c /usr/local/php5.6/etc/php.ini -y /usr/local/php5.6/etc/php-fpm.conf
 
#关闭php-fpm
kill -INT `cat /usr/local/php5.6/var/run/php-fpm.pid`
 
#重启php-fpm
kill -USR2 `cat /usr/local/php5.6/var/run/php-fpm.pid`

 

 

7 设置开机启动
  
   vi  /etc/init.d/php5.6-fpm 写入如下内容 根据实际情况修改

#!/bin/bash
# chkconfig: 2345 10 90
# description: php-fpm is a FastCGI web server.
# processname: php5.6-fpm
# config: /usr/local/php5.6/etc/php-fpm.conf
# pidfile: /usr/local/php5.6/var/run/php-fpm.pid
#=======================================================================================
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
    
BINFILE="/usr/local/php5.6/sbin/php-fpm"
CFGFILE="/usr/local/php5.6/etc/php-fpm.conf"
PIDFILE="/usr/local/php5.6/var/run/php-fpm.pid"
LOCKFILE="/usr/local/php5.6/var/run/php-fpm.lock"
    
RETVAL=0
    
start() {
    [[ -x $BINFILE ]] || exit 5
    [[ -f $CFGFILE ]] || exit 6
       
    if [[ `ps aux | grep php-fpm: | grep -v grep | wc -l` -gt 0 ]]; then
        echo "The php-fpm is already running."
        return 1
    fi
       
    $BINFILE -t >/dev/null 2>&1
       
    if [[ $? -ne 0 ]]; then
        echo "The php-fpm configure has error."
        return 1
    fi
       
    echo -n "Starting php-fpm......"
    $BINFILE -y $CFGFILE -g ${PIDFILE}
    RETVAL=$?
    echo
    [[ $RETVAL -eq 0 ]] && touch $LOCKFILE
       
    return $RETVAL
}
    
stop() {
    if [[ `ps aux | grep php-fpm: | grep -v grep | wc -l` -eq 0 ]]; then
        echo "The php-fpm is not running."
        return 1
    fi
       
    echo -n "Shutting down php-fpm......"
       
    if [[ -f $PIDFILE ]]; then
        kill -QUIT `cat ${PIDFILE}`
    else
        kill -QUIT `ps aux | grep php-fpm | awk '/master/{print $2}'`
    fi
       
    RETVAL=$?
    echo
    [[ $RETVAL -eq 0 ]] && rm -f $LOCKFILE $PIDFILE
       
    return $RETVAL
}
    
restart() {
    stop
    sleep 1
       
    while true
    do
        if [[ `ps aux | grep php-fpm: | grep -v grep | wc -l` -eq 0 ]]; then
            start
            break
        fi
        sleep 1
    done
       
    RETVAL=$?
    echo
       
    return $RETVAL
}
    
reload() {
    if [[ `ps aux | grep php-fpm: | grep -v grep | wc -l` -eq 0 ]]; then
        echo "The php-fpm is not running."
        return 1
    fi
       
    echo -n $"Reloading php-fpm......"
       
    if [[ -f $PIDFILE ]]; then
        kill -USR2 `cat ${PIDFILE}`
    else
        kill -USR2 `ps aux | grep php-fpm | awk '/master/{print $2}'`
    fi
       
    RETVAL=$?
    echo
       
    return $RETVAL
}
    
case "$1" in
start)
    start
    ;;
       
stop)
    stop
    ;;
       
restart)
    restart
    ;;
       
reload)
    reload
    ;;
       
*)
    echo "Usage: service php-fpm {start|stop|restart|reload}"
    RETVAL=1
esac
    
exit $RETVAL

 

8 配置开机自动
 
  chmod 755 /etc/init.d/php5.6-fpm
  chkconfig --add php5.6-fpm
  chkconfig  php5.6-fpm on
  /etc/init.d/php5.6-fpm start

 

标签:LTS,12,5.6,fpm,--,usr,php,local,php5.6
From: https://www.cnblogs.com/jackspider/p/18143994

相关文章

  • Alibaba Cloud Linux 3.2104 LTS 安装mysql5.7.39
    1上传mysql安装包到linux服务器tar-zxvfmysql-5.7.39-linux-glibc2.12-x86_64.tar.gzmvmysql-5.7.39-linux-glibc2.12-x86_64mysql5.72创建mysql用户groupaddmysqluseradd-gmysql-s/sbin/nologinmysqlchown-Rmysql:mysqlmysql5.7 ......
  • https://blog.csdn.net/qq_64314976/article/details/125843147
    importjava.awt.FlowLayout;importjava.awt.GridLayout;importjava.awt.event.ActionEvent;importjava.awt.event.ActionListener;importjavax.swing.ButtonGroup;importjavax.swing.JButton;importjavax.swing.JCheckBox;importjavax.swing.JComboBox;importjavax.s......
  • # Linux From Scratch 12.1 安装笔记
    目录目录安装指南相关链接准备工作准备宿主机准备硬盘下载软件添加LFS用户配置环境开始构建构建过程概述构建LFS交叉工具链和临时工具进入Chroot并构建其他工具构建LFS系统安装软件系统配置安装内核安装引导安装指南版本12.1-systemd-中文翻译......
  • 洛谷题单指南-动态规划1-P1216 [USACO1.5] [IOI1994]数字三角形 Number Triangles
    原题链接:https://www.luogu.com.cn/problem/P1216题意解读:计算数字三角形最高点到最后一行路径之和最大值,典型线性DP。解题思路:设a[i][j]表示数字三角形的值,设dp[i][j]表示从最高点到第i行第j列路径之和的最大值,由于每一步可以走到左下方的点也可以到达右下方的点,所以dp[i][......
  • [ABC212E] Safety Journey 题解
    [ABC212E]SafetyJourney题解思路解析首先根据题目的条件我们可以想到dp,用\(f_{i,j}\)表示走了\(i\)步,现在在\(j\)的方案数,可见转移即是\(f_{i,u}\gets\sum{f_{i-1,v}}\),这里的\(v\)表示每个与\(u\)相连的点。可见如此做时间复杂度为\(O(kn(\frac{n(n-1)}{2}-m......
  • ABC212 复盘
    ABC212复盘[ABC212C]MinDifference思路解析与\(a_i\)差值最小的某个\(b_j\)要么是第一个大于它的值,要么是第一个小于它的值,而这两个值都可以用二分求得,于是我们直接将\(b\)数组排序,然后对于每一个\(a_i\)都用二分找到上文提到的两个值即可。code#include<bits/std......
  • 【Nano Framework ESP32篇】WS2812 彩色灯带实验
    地球人皆知,许多物联网教程作者的心中都深爱着一灯大师,所以第一个例程总喜欢点灯,高级一点的会来个“一闪一闪亮晶晶”。老周今天要扯的也是和灯有关的,但不单纯地点个灯,那样实在不好玩,缺乏乐趣。老周打算舞个龙灯,哦不,是用LED彩色灯带给伙伴们整点炫酷乐子。说到这LED彩灯,咱们常见......
  • 12_QT跨平台运行之使用QT控制蜂鸣器
    QT跨平台运行之使用QT控制蜂鸣器QT****下操作硬件我们在QT上要怎么操作驱动呢?比如,我们要点亮一个led灯,我们在C语言中可以使用open,read,write,ioctl函数来进行操作,但是QT上我们使用的语言是C++,那我们要怎么来操作驱动呢?我们可以使用C和C++进行混合编程,我们先来看一个控制蜂鸣器的......
  • 123123
    #include<stdio.h>#include<stdint.h>#pragmapack(push,1)typedefstruct{   struct{      uint16_tmon:8;            //月      uint16_tyear:8;         //以2000年为基准   };   struct{      uint1......
  • ADV7123驱动VGA显示色条
    VGA显示色条-基于ADV7123用ADV7123代替权电阻网络,执行数模转换,差别在于rgb都变成8位,显示的色彩更多。控制端口多了3个:像素时钟,复合同步信号(不用就置0),消隐信号。     相对权电阻网络的代码,主要有4处修改:一是端口声明加上新增的3个信号;二是设定复用模式的同步信号为0;三......