美文网首页
wdcp升级php7.3.4脚本

wdcp升级php7.3.4脚本

作者: Sirius之剣 | 来源:发表于2019-04-27 09:22 被阅读0次

    升级完MYSQL后需要重新编译PHP

    #!/bin/bash
    
    if [ ! $1 ];then
        Ver=7.3.4
    else
        Ver=$1
    fi
    
    echo
    #read -p "PRESS ENTER IF YOU REALLY WANT TO UPDATE"
    read -p "DO YOU REALLY WANT TO UPDATE? (Y/N): " yn
    if [ "$yn" == "Y" ] || [ "$yn" == "y" ]; then
        echo "PHP IS NOW UPDATING!"
    else
        exit
    fi
    echo
    echo "-------------------------------------------------------------"
    echo
    
    ###yum
    yum clean all
    yum install -y gcc gcc-c++ make autoconf libtool-ltdl-devel gd-devel freetype-devel libxml2-devel libjpeg-devel libpng-devel openssl-devel curl-devel patch libmcrypt-devel libmhash-devel ncurses-devel bzip2-devel libcap-devel gmp-devel t1lib-devel libc-client-devel sqlite-devel aspell-devel readline-devel recode-devel libtidy-devel libxslt-devel openldap-devel
    ln -s /usr/lib64/libc-client.so /usr/lib/libc-client.so
    ###
    if [ ! -f php-${Ver}.tar.gz ];then
        wget -c http://cn2.php.net/distributions/php-${Ver}.tar.gz
    fi
    if [ ! -f iconv_ins.sh ];then
        wget -c http://down.wdlinux.cn/in/iconv_ins.sh
    fi
        sh iconv_ins.sh
    
    ###
    if [ -f /www/wdlinux/mysql/lib/libmysqlclient.so.20 ];then
        if [ -d /usr/lib64 ];then
            LIBNCU="/usr/lib64"
        else
            LIBNCU="/usr/lib"
        fi
        ln -sf /www/wdlinux/mysql/lib/libmysqlclient.so.20 $LIBNCU
    fi
    if [ ! -f php-${Ver} ];then
    tar zxvf php-${Ver}.tar.gz
    fi
    cd php-${Ver}
    if [ -d /www/wdlinux/apache_php ];then
    make clean
    ./configure \
    --prefix=/www/wdlinux/apache_php-${Ver} \
    --exec-prefix=/www/wdlinux/apache_php-${Ver} \
    --bindir=/www/wdlinux/apache_php-${Ver}/bin \
    --sbindir=/www/wdlinux/apache_php-${Ver}/sbin \
    --libdir=/www/wdlinux/apache_php-${Ver}/lib/php \
    --mandir=/www/wdlinux/apache_php-${Ver}/php/man \
    --with-config-file-path=/www/wdlinux/apache_php-${Ver}/etc \
    --with-apxs2=/www/wdlinux/apache/bin/apxs \
    --with-mcrypt=/usr/include \
    --with-mhash \
    --with-openssl \
    --with-mysqli=/www/wdlinux/mysql/bin/mysql_config \
    --with-pdo-mysql=/www/wdlinux/mysql \
    --with-gd \
    --with-iconv \
    --with-zlib \
    --enable-zip \
    --enable-inline-optimization \
    --disable-debug \
    --disable-rpath \
    --enable-shared \
    --enable-xml \
    --enable-bcmath \
    --enable-shmop \
    --enable-sysvsem \
    --enable-mbregex \
    --enable-mbstring \
    --enable-ftp \
    --enable-gd-native-ttf \
    --enable-pcntl \
    --enable-sockets \
    --with-xmlrpc \
    --enable-soap \
    --without-pear \
    --with-gettext \
    --enable-session \
    --with-curl \
    --with-jpeg-dir \
    --with-png-dir \
    --with-freetype-dir \
    --enable-opcache \
    --enable-fpm \
    --without-gdbm \
    --disable-fileinfo
    [ $? != 0 ] && echo "configure err" && exit
    make
    [ $? != 0 ] && echo "make err" && exit
    make install
    [ $? != 0 ] && echo "make install err" && exit
    cp php.ini-production /www/wdlinux/apache_php-${Ver}/etc/php.ini
    sed -i 's/short_open_tag = Off/short_open_tag = On/g' /www/wdlinux/apache_php-${Ver}/etc/php.ini
    rm -f /www/wdlinux/apache_php
    ln -sf /www/wdlinux/apache_php-${Ver} /www/wdlinux/apache_php
    if [ ! -d /www/wdlinux/apache_php-${Ver}/lib/php/extensions ];then
        mkdir -p /www/wdlinux/apache_php-${Ver}/lib/php/extensions/no-debug-zts-20131226
        ln -sf /www/wdlinux/apache_php-${Ver}/lib/php/extensions/no-debug-zts-20131226 /www/wdlinux/apache_php-${Ver}/lib/php/extensions/no-debug-non-zts-20131226
    fi
    service httpd restart
    echo
    echo "如果升级后httpd无法启动,打开httpd.conf,注释 #LoadModule php5_module        modules/libphp5.so"
    echo "php update compelete"
    fi
    
    if [ -d /www/wdlinux/nginx_php ];then
    make clean
        ./configure --prefix=/www/wdlinux/nginx_php-${Ver} --with-config-file-path=/www/wdlinux/nginx_php-${Ver}/etc --with-mysql=/www/wdlinux/mysql --with-iconv=/usr --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --with-mcrypt=/usr --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-soap --with-imap --with-kerberos --with-imap-ssl  --enable-ftp --enable-sockets --enable-zip --enable-fpm --with-mysqli=/www/wdlinux/mysql/bin/mysql_config --with-pdo-mysql=/www/wdlinux/mysql
    [ $? != 0 ] && echo "configure err" && exit
    make
    [ $? != 0 ] && echo "make err" && exit
    make install
    [ $? != 0 ] && echo "make install err" && exit
    cp php.ini-production /www/wdlinux/nginx_php-${Ver}/etc/php.ini
    sed -i 's/short_open_tag = Off/short_open_tag = On/g' /www/wdlinux/nginx_php-${Ver}/etc/php.ini
    service php-fpm stop
    rm -f /www/wdlinux/nginx_php
    ln -sf /www/wdlinux/nginx_php-${Ver} /www/wdlinux/nginx_php
    cp /www/wdlinux/nginx_php-${Ver}/etc/php-fpm.conf.default /www/wdlinux/nginx_php-${Ver}/etc/php-fpm.conf
    sed -i 's/user = nobody/user = www/g' /www/wdlinux/nginx_php/etc/php-fpm.conf
    sed -i 's/group = nobody/group = www/g' /www/wdlinux/nginx_php/etc/php-fpm.conf
    sed -i 's/;pid =/pid =/g' /www/wdlinux/nginx_php/etc/php-fpm.conf
    cp -f sapi/fpm/init.d.php-fpm /www/wdlinux/init.d/php-fpm
    chmod 755 /www/wdlinux/init.d/php-fpm
    if [ ! -d /www/wdlinux/nginx_php-${Ver}/lib/php/extensions ];then
        mkdir -p /www/wdlinux/nginx_php-${Ver}/lib/php/extensions/no-debug-zts-20131226
        ln -sf /www/wdlinux/nginx_php-${Ver}/lib/php/extensions/no-debug-zts-20131226 /www/wdlinux/nginx_php-${Ver}/lib/php/extensions/no-debug-non-zts-20131226
    fi
    service php-fpm start
    echo
    echo "php update is OK"
    fi
    echo
    
    

    相关文章

      网友评论

          本文标题:wdcp升级php7.3.4脚本

          本文链接:https://www.haomeiwen.com/subject/evzxnqtx.html