Board logo

标题: [发布] (代码版)PHP远程DOS漏洞解决方案让wdcp的PHP版本升级到最新5.6.9升级脚本 [打印本页]

作者: linwenzhi7    时间: 2015-7-30 20:07     标题: (代码版)PHP远程DOS漏洞解决方案让wdcp的PHP版本升级到最新5.6.9升级脚本

因为下载失效了,很多人需要,所以我提供出来,由于无法上传,只能把代码贴上来。
详情参照:http://www.wdlinux.cn/bbs/viewthread.php?tid=38431&highlight=
  1. #!/bin/bash
  2. # PHP 5.6 update scripts

  3. if [ ! $1 ];then
  4.         Ver=5.6.9
  5. else
  6.         Ver=$1
  7. fi

  8. Debugfile=20121212

  9. echo "THANK YOU FOR USING UPDATE SCRIPT www.hjdown.com"
  10. echo "YOU ARE GOING TO UPDATE YOUR PHP TO ${Ver}"
  11. echo "YOU CAN JUST HAVE A REST"
  12. echo "IT MAY TAKE A LOT OF TIME"
  13. echo
  14. #read -p "PRESS ENTER IF YOU REALLY WANT TO UPDATE"
  15. read -p "DO YOU REALLY WANT TO UPDATE? (Y/N)" yn
  16. if [ "$yn" == "Y" ] || [ "$yn" == "y" ]; then
  17.         echo "PHP IS NOW UPDATING!"
  18. else
  19.         exit
  20. fi
  21. echo
  22. echo "-------------------------------------------------------------"
  23. echo

  24. ###yum
  25. yum install -y libmcrypt-devel libjpeg-devel libpng-devel freetype-devel curl-devel openssl-devel libxml2-devel zip unzip

  26. ###
  27. if [ ! -f php-${Ver}.tar.gz ];then
  28.         wget -c http://us1.php.net/distributions/php-${Ver}.tar.gz
  29. fi
  30. if [ ! -f iconv_ins.sh ];then
  31.         wget -c http://down.wdlinux.cn/in/iconv_ins.sh
  32.         sh iconv_ins.sh
  33. fi

  34. ###
  35. if [ -f /www/wdlinux/mysql/lib/libmysqlclient.so.18 ];then
  36.         if [ -d /usr/lib64 ];then
  37.                 LIBNCU="/usr/lib64"
  38.         else
  39.                 LIBNCU="/usr/lib"
  40.         fi
  41.         ln -sf /www/wdlinux/mysql/lib/libmysqlclient.so.18 $LIBNCU
  42. fi

  43. tar zxvf php-${Ver}.tar.gz
  44. cd php-${Ver}
  45. if [ -d /www/wdlinux/apache_php ];then
  46. echo "START CONFIGURING PHP ON NGINX"
  47. sleep 3
  48. make clean
  49.         ./configure --prefix=/www/wdlinux/apache_php-${Ver} --with-config-file-path=/www/wdlinux/apache_php-${Ver}/etc --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-ftp --enable-sockets --enable-zip --with-apxs2=/www/wdlinux/apache/bin/apxs --with-mysqli=/www/wdlinux/mysql/bin/mysql_config --with-pdo-mysql=/www/wdlinux/mysql --enable-opcache --enable-bcmath --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd
  50. [ $? != 0 ] && echo "NO! CONFIGURE ERROR! TRY AGAIN ! :(" && exit
  51. echo "START MAKE"
  52. sleep 3
  53. make
  54. [ $? != 0 ] && echo "NO! MAKE ERROR! TRY AGAIN ! :(" && exit
  55. echo "START MAKE INSTALL"
  56. sleep 3
  57. make install
  58. [ $? != 0 ] && echo "NO! MAKE INSTALL ERROR! TRY AGAIN ! :(" && exit
  59. cp php.ini-production /www/wdlinux/apache_php-${Ver}/etc/php.ini
  60. sed -i 's/short_open_tag = Off/short_open_tag = On/g' /www/wdlinux/apache_php-${Ver}/etc/php.ini
  61. rm -f /www/wdlinux/apache_php
  62. ln -sf /www/wdlinux/apache_php-${Ver} /www/wdlinux/apache_php
  63. if [ ! -d /www/wdlinux/apache_php-${Ver}/lib/php/extensions ];then
  64.         mkdir -p /www/wdlinux/apache_php-${Ver}/lib/php/extensions/no-debug-zts-${Debugfile}
  65.         ln -sf /www/wdlinux/apache_php-${Ver}/lib/php/extensions/no-debug-zts-${Debugfile} /www/wdlinux/apache_php-${Ver}/lib/php/extensions/no-debug-non-zts-${Debugfile}
  66. fi
  67. service httpd restart
  68. fi

  69. if [ -d /www/wdlinux/nginx_php ];then
  70. echo "START CONFIGURING PHP ON APACHE"
  71. sleep 3
  72. make clean
  73.         ./configure --prefix=/www/wdlinux/nginx_php-${Ver} --with-config-file-path=/www/wdlinux/nginx_php-${Ver}/etc --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-ftp --enable-sockets --enable-zip --enable-fpm --with-mysqli=/www/wdlinux/mysql/bin/mysql_config --with-pdo-mysql=/www/wdlinux/mysql --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd
  74. [ $? != 0 ] && echo "NO! CONFIGURE ERROR! TRY AGAIN ! :(" && exit
  75. echo "START MAKE"
  76. sleep 3
  77. make
  78. [ $? != 0 ] && echo "NO! MAKE ERROR! TRY AGAIN ! :(" && exit
  79. echo "START MAKE INSTALL"
  80. sleep 3
  81. make install
  82. [ $? != 0 ] && echo "NO! MAKE INSTALL ERROR! TRY AGAIN ! :(" && exit
  83. cp php.ini-production /www/wdlinux/nginx_php-${Ver}/etc/php.ini
  84. sed -i 's/short_open_tag = Off/short_open_tag = On/g' /www/wdlinux/nginx_php-${Ver}/etc/php.ini
  85. service php-fpm stop
  86. rm -f /www/wdlinux/nginx_php
  87. ln -sf /www/wdlinux/nginx_php-${Ver} /www/wdlinux/nginx_php
  88. cp /www/wdlinux/nginx_php-${Ver}/etc/php-fpm.conf.default /www/wdlinux/nginx_php-${Ver}/etc/php-fpm.conf
  89. sed -i 's/user = nobody/user = www/g' /www/wdlinux/nginx_php/etc/php-fpm.conf
  90. sed -i 's/group = nobody/group = www/g' /www/wdlinux/nginx_php/etc/php-fpm.conf
  91. sed -i 's/;pid =/pid =/g' /www/wdlinux/nginx_php/etc/php-fpm.conf
  92. cp -f sapi/fpm/init.d.php-fpm /www/wdlinux/init.d/php-fpm
  93. chmod 755 /www/wdlinux/init.d/php-fpm
  94. if [ ! -d /www/wdlinux/nginx_php-${Ver}/lib/php/extensions ];then
  95.         mkdir -p /www/wdlinux/nginx_php-${Ver}/lib/php/extensions/no-debug-zts-${Debugfile}
  96.         ln -sf /www/wdlinux/nginx_php-${Ver}/lib/php/extensions/no-debug-zts-${Debugfile} /www/wdlinux/nginx_php-${Ver}/lib/php/extensions/no-debug-non-zts-${Debugfile}
  97. fi
  98. fi
  99. cd ..
  100. rm -rf php-${Ver}/
  101. rm -rf php-${Ver}.tar.gz
  102. rm -rf iconv_ins.sh
  103. echo
  104. echo "---------------------www.hjdown.com-------------------------------------"
  105. echo "PHP UPDATE FINISH! :D"
  106. echo "NOW YOUR PHP VERSION IS ${Ver}!"
  107. echo "UPDATE SCRIPT www.hjdown.com "
  108. echo "THANK YOU FOR USING"
  109. echo
  110. echo "PS: I THINK YOU NEED RESTART SERVER AFTER UPDATE."
  111. echo "PS2: REMEMBER TO VISIT www.hjdown.com"
  112. echo
复制代码





欢迎光临 WDlinux官方论坛 (http://wdlinux.cn/bbs/) Powered by Discuz! 7.2