本文共 4415 字,大约阅读时间需要 14 分钟。
#!/bin/bashPATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/binexport PATH# Check if user is rootif [ $(id -u) != "0" ]; then echo "Error: You must be root to run this script, please use root to install lnmp" exit 1ficlearecho "======================================================================="echo "Install Yaf for LNMP , Written by Licess "echo "======================================================================="echo "LNMP is a tool to auto-compile & install Nginx+MySQL+PHP on Linux "echo "This script is a tool to install Yaf for lnmp "echo ""echo "more information please visit http://www.lnmp.org "echo "======================================================================="cur_dir=$(pwd) ver="new" echo "Which version do you want to install:" echo "Install Yaf 2.2.9 stable please type: s" echo "Install Yaf 2.3.2 beta please type: b" read -p "Type old or new (Default install Yaf 2.2.9 stable):" ver if [ "$ver" = "" ]; then ver="s" fi if [ "$ver" = "s" ]; then echo "You will install Yaf 2.2.9 stable" elif [ "$ver" = "b" ]; then echo "You will install Yaf 2.3.2 beta" else echo "Input error,please input s or b !" echo "Please Rerun $0" exit 1 fi get_char() { SAVEDSTTY=`stty -g` stty -echo stty cbreak dd if=/dev/tty bs=1 count=1 2> /dev/null stty -raw stty echo stty $SAVEDSTTY } echo "" echo "Press any key to start...or Press Ctrl+c to cancel" char=`get_char`echo "=========================== Install Yaf ======================"if [ -s /usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/yaf.so ]; then rm -f /usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/yaf.soelif [ -s /usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/yaf.so ]; then rm -f /usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/yaf.soelif [ -s /usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/yaf.so ]; then rm -f /usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/yaf.soelif [ -s /usr/local/php/lib/php/extensions/no-debug-non-zts-20121212/yaf.so ]; then rm -f /usr/local/php/lib/php/extensions/no-debug-non-zts-20121212/yaf.soficur_php_version=`/usr/local/php/bin/php -v`if [[ "$cur_php_version" =~ "PHP 5.2." ]]; then zend_ext="/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/yaf.so"elif [[ "$cur_php_version" =~ "PHP 5.3." ]]; then zend_ext="/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/yaf.so"elif [[ "$cur_php_version" =~ "PHP 5.4." ]]; then zend_ext="/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/yaf.so"elif [[ "$cur_php_version" =~ "PHP 5.5." ]]; then zend_ext="/usr/local/php/lib/php/extensions/no-debug-non-zts-20121212/yaf.so"else echo "Error: can't get php version!" echo "Maybe your php was didn't install or php configuration file has errors.Please check." sleep 3 exit 1fifunction install_s_yaf{if [ -s yaf-2.2.9 ]; then rm -rf yaf-2.2.9/fised -i '/yaf.so/d' /usr/local/php/etc/php.iniwget -c http://pecl.php.net/get/yaf-2.2.9.tgztar zxf yaf-2.2.9.tgzcd yaf-2.2.9//usr/local/php/bin/phpize./configure --with-php-config=/usr/local/php/bin/php-configmake && make installcd ../sed -i '/the dl()/i\ extension = "yaf.so"' /usr/local/php/etc/php.ini}function install_b_yaf{if [ -s yaf-2.3.2 ]; then rm -rf yaf-2.3.2/fised -i '/yaf.so/d' /usr/local/php/etc/php.iniwget -c http://pecl.php.net/get/yaf-2.3.2.tgztar zxf yaf-2.3.2.tgzcd yaf-2.3.2//usr/local/php/bin/phpize./configure --with-php-config=/usr/local/php/bin/php-configmake && make installcd ../sed -i '/the dl()/i\ extension = "yaf.so"' /usr/local/php/etc/php.ini}if [ "$ver" = "s" ]; then install_s_yafelse install_b_yaffiif [ -s /etc/init.d/httpd ] && [ -s /usr/local/apache ]; thenecho "Restarting Apache......"/etc/init.d/httpd -k restartelseecho "Restarting php-fpm......"/etc/init.d/php-fpm restartfiecho "===================== install yaf completed ========================"echo "Install yaf completed,enjoy it!"echo "======================================================================="echo "Install yaf for LNMP , Written by Wangys "echo "======================================================================="echo "LNMP is a tool to auto-compile & install Nginx+MySQL+PHP on Linux "echo "This script is a tool to install wangys for lnmp "echo ""echo "For more information please visit http://www.lnmp.org "echo "======================================================================="
转载地址:http://ipabb.baihongyu.com/