zoukankan      html  css  js  c++  java
  • php环境搭建脚本

    #!/bin/bash
    
    # 安装依赖包
    yum -y install gcc gcc-c++ libxml2 libxml2-devel bzip2 bzip2-devel libmcrypt libmcrypt-devel openssl openssl-devel libcurl-devel libjpeg-devel libpng-devel freetype-devel readline readline-devel libxslt-devel perl perl-devel psmisc.x86_64 recode recode-devel libtidy libtidy-devel  epel-release libmcrypt-devel  autoconf epel-release libmcrypt libmcrypt-devel
    
    # 准备php安装包
    cd /usr/local/src/ || exit
    wget http://cn2.php.net/distributions/php-5.6.32.tar.gz
    tar zxvf php-5.6.32.tar.gz
    
    # 添加用户
    useradd -s /sbin/nologin php-fpm
    
    # 编译安装
    cd php-5.6.32 || exit
    ./configure --prefix=/usr/local/php --sysconfdir=/usr/local/php/etc --with-config-file-path=/usr/local/php/etc/    --with-fpm-user=php-fpm  --with-fpm-group=php-fpm  --enable-fpm --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-mhash  --with-openssl --with-zlib --with-bz2 --with-curl --with-libxml-dir --with-gd --with-jpeg-dir  --with-png-dir --with-zlib --enable-mbstring --with-mcrypt --enable-sockets --with-iconv-dir   --enable-zip --with-pcre-dir --with-pear --enable-session  --enable-gd-native-ttf  --enable-xml --with-freetype-dir --enable-gd-jis-conv --enable-inline-optimization --enable-shared  --enable-soap --enable-bcmath --enable-sysvmsg --enable-sysvsem --enable-sysvshm  --enable-mbregex --enable-pcntl --with-xmlrpc --with-gettext --enable-exif --with-readline   --enable-ftp   --enable-redis
    if [ $? -ne 0 ] ; then
        yum -y install epel-release libmcrypt libmcrypt-devel # 前面yum安装指定了这三个包,也有时候安装不了,导致预编译出错。为了避免,这里再安装一遍
    fi
    make && make install
    if [ $? -ne 0 ] ; then
        echo "无法安装!"
        exit 1
    fi
    
    # 从安装包里拷贝生产环境的配置文件到php目录下
    cp php.ini-production /usr/local/php/etc/php.ini
    
    # 准备启动脚本,启动php-fpm并设置php-fpm开机自启
    cp /usr/local/src/php-5.6.32/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
    mv /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
    chmod 755 /etc/init.d/php-fpm
    chkconfig --add php-fpm
    service php-fpm start
    chkconfig php-fpm on
    
    # 添加到环境变量中
    sed -i '$a export PATH=/usr/local/php/bin:$PATH' /etc/profile
    source /etc/profile
  • 相关阅读:
    【hive】null值判断
    【hive】where使用注意的问题
    【hive】关于浮点数比较的问题
    【hive】在alter修改元数据的时候报错 mismatched input 'xxxxx' expecting KW_EXCHANGE
    破解诅咒心法
    泡妞心法
    awk高级
    排除故障的总结
    机房运维相关面试题
    统计流入流出流量
  • 原文地址:https://www.cnblogs.com/chenpingan/p/10629239.html
Copyright © 2011-2022 走看看