自動安裝php7(配置未最佳化版本)

來源:互聯網
上載者:User

標籤:freetype   usr   dir   end   mysqli   for   port   pen   conf   

#!/bin/bash#by dxd in 2017-6#only suit for centos/aliyun os, and based on aliyun install scriptCURR_PATH=$(pwd)DOWNLOAD_LIBMCRYPT_URL=http://download.verymall.cn/libmcrypt-2.5.8.tar.gzDOWNLOAD_PHP7_URL=http://download.verymall.cn/php7.bz2DOWNLOAD_PHP_INI_URL=http://download.verymall.cn/php7.iniPHP_INSTALL_PATH=/alidata/server/php7PHP_FPM_PORT=9001function check_user(){    if [ "$(whoami)" != "root" ]     then        echo "please run as root"        exit 1    fi}function update_linux(){    yum update && yum upgrade    yum groupinstall "Development Tools"    yum install gcc gcc-c++ pcre* openssl* gd-devel* zlib-devel pcre-devel libxml2-devel curl-devel}function check_curr_path_auth(){    if [ ! -w $CURR_PATH ]    then        echo "current path has no write auth"        exit 1    fi}function is_curr_path_legal(){    if [ "$(ls | grep install.sh)" == "" ]    then        echo "path is illegal"        exit 1    fi}function check_gcc(){    which gcc > /dev/null 2>&1    if [ "$?" != "0" ]    then        echo "please install gcc first"        exit 1    fi}function check_fpm_port(){    if [ -n "$(lsof -i:$PHP_FPM_PORT)" ]    then        echo "PORT $PHP_FPM_PORT is occupied"        exit 1    fi}function check_alidata_path(){    if [ ! -d /alidata ]    then        mkdir /alidata    fi    if [ ! -d /alidata/server ]    then        echo "alidata server has not been installed"        exit 1    fi    mkdir $PHP_INSTALL_PATH}function install_dos2unix(){    which dos2unix > /dev/null 2>&1    if [ "$?" != "0" ]    then        yum install dos2unix    fi}function download_and_install_libmcrypt(){    if [ -a ./libmcrypt-2.5.8.tar.gz ] && [ -n "$(md5sum ./libmcrypt-2.5.8.tar.gz | grep 0821830d930a86a5c69110837c55b7da)" ]    then        echo "./libmcrypt-2.5.8.tar.gz exist"    else        rm -f ./libmcrypt-2.5.8.tar.gz        wget $DOWNLOAD_LIBMCRYPT_URL    fi    tar -zxvf ./libmcrypt-2.5.8.tar.gz    cd ./libmcrypt-2.5.8    ./configure    make    make install    cd $CURR_PATH}function update_ld(){    if [ -z "$(cat /etc/ld.so.conf | grep /usr/local/lib)" ]    then        echo "/usr/local/lib" >> /etc/ld.so.conf    fi    if [ -z "$(cat /etc/ld.so.conf | grep /usr/lib64)" ]    then        echo "/usr/lib64" >> /etc/ld.so.conf    fi    ldconfig}function download_php7(){    cd $CURR_PATH     if [ -a ./php7.bz2 ] && [ -n "$(md5sum ./php7.bz2 | grep fb88987cd0c7fefa527f2170a2617f78)" ]    then        echo "./php7.bz2 exist"    else        rm -f ./php7.bz2        wget $DOWNLOAD_PHP7_URL    fi    #uncompress bz2 file    tar -xvf ./php7.bz2 > /dev/null}function install_php7(){    cd $CURR_PATH     cd ./php-7.1.6    mkdir /usr/lib64/    ln -s /usr/local/lib/libiconv.so.2 /usr/lib64/    ./configure     --prefix=$PHP_INSTALL_PATH     --exec-prefix=$PHP_INSTALL_PATH     --bindir=$PHP_INSTALL_PATH/bin     --sbindir=$PHP_INSTALL_PATH/sbin     --includedir=$PHP_INSTALL_PATH/include     --libdir=$PHP_INSTALL_PATH/lib/php     --mandir=$PHP_INSTALL_PATH/php/man     --with-config-file-path=$PHP_INSTALL_PATH/etc     --with-mcrypt=/usr/include     --with-mhash     --with-openssl     --with-mysqli=shared,mysqlnd     --with-pdo-mysql=shared,mysqlnd     --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-freetype-dir     --enable-opcache     --enable-fpm     --without-gdbm     --enable-fileinfo#    --disable-fileinfo        make ZEND_EXTRA_LIBS=‘-liconv‘    make install}function config_php7(){    if [ ! -a $PHP_INSTALL_PATH/etc/php-fpm.conf ]    then        cp $PHP_INSTALL_PATH/etc/php-fpm.conf.default $PHP_INSTALL_PATH/etc/php-fpm.conf    fi        if [ ! -a $PHP_INSTALL_PATH/etc/php-fpm.d/www.conf ]    then        cp $PHP_INSTALL_PATH/etc/php-fpm.d/www.conf.default $PHP_INSTALL_PATH/etc/php-fpm.d/www.conf    fi    if [ -z "$(cat $PHP_INSTALL_PATH/etc/php-fpm.conf | grep 127)" ]    then        echo "listen = 127.0.0.1:$PHP_FPM_PORT" >> $PHP_INSTALL_PATH/etc/php-fpm.conf        echo "listen.backlog = -1" >> $PHP_INSTALL_PATH/etc/php-fpm.conf        echo "listen.owner = www" >> $PHP_INSTALL_PATH/etc/php-fpm.conf        echo "listen.group = www" >> $PHP_INSTALL_PATH/etc/php-fpm.conf        echo "listen.mode = 0666" >> $PHP_INSTALL_PATH/etc/php-fpm.conf        echo "user = www" >> $PHP_INSTALL_PATH/etc/php-fpm.conf        echo "group = www" >> $PHP_INSTALL_PATH/etc/php-fpm.conf    fi    if [ ! -a $PHP_INSTALL_PATH/etc/php.ini ]    then        wget $DOWNLOAD_PHP_INI_URL -O $PHP_INSTALL_PATH/etc/php.ini    fi}function start_php_fpm(){    $PHP_INSTALL_PATH/sbin/php-fpm}check_userupdate_linuxis_curr_path_legalcheck_curr_path_authcheck_gcccheck_fpm_portcheck_alidata_pathinstall_dos2unixdownload_and_install_libmcryptupdate_lddownload_php7install_php7config_php7start_php_fpmecho "php7 install successfully"exit 0

 

自動安裝php7(配置未最佳化版本)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.