首页 > 代码库 > yaf自动安装
yaf自动安装
#!/bin/bash PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin export PATH # Check if user is root if [ $(id -u) != "0" ]; then echo "Error: You must be root to run this script, please use root to install lnmp" exit 1 fi clear echo "=======================================================================" 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.so elif [ -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.so elif [ -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.so elif [ -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.so fi cur_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 1 fi function install_s_yaf { if [ -s yaf-2.2.9 ]; then rm -rf yaf-2.2.9/ fi sed -i '/yaf.so/d' /usr/local/php/etc/php.ini wget -c http://pecl.php.net/get/yaf-2.2.9.tgz tar zxf yaf-2.2.9.tgz cd yaf-2.2.9/ /usr/local/php/bin/phpize ./configure --with-php-config=/usr/local/php/bin/php-config make && make install cd ../ 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/ fi sed -i '/yaf.so/d' /usr/local/php/etc/php.ini wget -c http://pecl.php.net/get/yaf-2.3.2.tgz tar zxf yaf-2.3.2.tgz cd yaf-2.3.2/ /usr/local/php/bin/phpize ./configure --with-php-config=/usr/local/php/bin/php-config make && make install cd ../ sed -i '/the dl()/i extension = "yaf.so"' /usr/local/php/etc/php.ini } if [ "$ver" = "s" ]; then install_s_yaf else install_b_yaf fi if [ -s /etc/init.d/httpd ] && [ -s /usr/local/apache ]; then echo "Restarting Apache......" /etc/init.d/httpd -k restart else echo "Restarting php-fpm......" /etc/init.d/php-fpm restart fi echo "===================== 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 "======================================================================="
yaf自动安装
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。