虚拟化容器,大数据,DBA,中间件,监控。

WDCP面板升级PHP5.4、php5.6,MySql5.5、Zend Guard Loader7版本

22 11月
作者:admin|分类:系统运维

WDCP面板升级PHP5.4、php5.6,MySql5.5、Zend Guard Loader7版本


下面是升级 php5.4 的脚本:

#!/bin/bash
# PHP 5.4 update scripts
# Author: wdlinux
# Url: http://www.wdlinux.cn

if [ ! $1 ];then
    Ver=5.4.26
else
    Ver=$1
fi

###yum
yum install -y libmcrypt-devel libjpeg-devel libpng-devel freetype-devel curl-devel openssl-devel libxml2-devel

###
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
    sh iconv_ins.sh
fi

###
if [ -f /www/wdlinux/mysql/lib/libmysqlclient.so.18 ];then
    if [ -d /usr/lib64 ];then
        LIBNCU="/usr/lib64"
    else
        LIBNCU="/usr/lib"
    fi
    ln -sf /www/wdlinux/mysql/lib/libmysqlclient.so.18 $LIBNCU
fi

tar zxvf php-${Ver}.tar.gz
cd php-${Ver}
if [ -d /www/wdlinux/apache_php ];then
make clean
    ./configure --prefix=/www/wdlinux/apache_php-${Ver} --with-config-file-path=/www/wdlinux/apache_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-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 --with-pdo-mysql=mysqlnd
[ $? != 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-20100525
    ln -sf /www/wdlinux/apache_php-${Ver}/lib/php/extensions/no-debug-zts-20100525 /www/wdlinux/apache_php-${Ver}/lib/php/extensions/no-debug-non-zts-20100525
fi
service httpd restart
echo
echo "php update is OK"
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-ftp --enable-sockets --enable-zip --enable-fpm --with-mysqli=/www/wdlinux/mysql/bin/mysql_config --with-pdo-mysql=/www/wdlinux/mysql --with-pdo-mysql=mysqlnd
[ $? != 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-20100525
    ln -sf /www/wdlinux/nginx_php-${Ver}/lib/php/extensions/no-debug-zts-20100525 /www/wdlinux/nginx_php-${Ver}/lib/php/extensions/no-debug-non-zts-20100525
fi
service php-fpm start
echo
echo "php update is OK"
fi
echo




下面的是升级 php 5.6的脚本 :


#!/bin/bash
# PHP 5.6.9 update scripts

if [ ! $1 ];then
    Ver=5.6.9
else
    Ver=$1
fi

Debugfile=20121212

echo "THANK YOU FOR USING UPDATE SCRIPT MADE BY  HTTP://WWW.AREFLY.COM & HTTP://WWW.ITBULU.COM"
echo "YOU ARE GOING TO UPDATE YOUR PHP TO ${Ver}"
echo "YOU CAN JUST HAVE A REST"
echo "IT MAY TAKE A LOT OF TIME"
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 install -y libmcrypt-devel libjpeg-devel libpng-devel freetype-devel curl-devel openssl-devel libxml2-devel zip unzip

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

###
if [ -f /www/wdlinux/mysql/lib/libmysqlclient.so.18 ];then
    if [ -d /usr/lib64 ];then
        LIBNCU="/usr/lib64"
    else
        LIBNCU="/usr/lib"
    fi
    ln -sf /www/wdlinux/mysql/lib/libmysqlclient.so.18 $LIBNCU
fi

tar zxvf php-${Ver}.tar.gz
cd php-${Ver}
if [ -d /www/wdlinux/apache_php ];then
echo "START CONFIGURING PHP ON NGINX"
sleep 3
make clean
    ./configure --disable-fileinfo --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
[ $? != 0 ] && echo "NO! CONFIGURE ERROR! TRY AGAIN OR ASK IN THE BBS! :(" && exit
echo "START MAKE"
sleep 3
make
[ $? != 0 ] && echo "NO! MAKE ERROR! TRY AGAIN OR ASK IN THE BBS! :(" && exit
echo "START MAKE INSTALL"
sleep 3
make install
[ $? != 0 ] && echo "NO! MAKE INSTALL ERROR! TRY AGAIN OR ASK IN THE BBS! :(" && 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-${Debugfile}
    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}
fi
service httpd restart
fi

if [ -d /www/wdlinux/nginx_php ];then
echo "START CONFIGURING PHP ON APACHE"
sleep 3
make clean
    ./configure --disable-fileinfo --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
[ $? != 0 ] && echo "NO! CONFIGURE ERROR! TRY AGAIN OR ASK IN THE BBS! :(" && exit
echo "START MAKE"
sleep 3
make
[ $? != 0 ] && echo "NO! MAKE ERROR! TRY AGAIN OR ASK IN THE BBS! :(" && exit
echo "START MAKE INSTALL"
sleep 3
make install
[ $? != 0 ] && echo "NO! MAKE INSTALL ERROR! TRY AGAIN OR ASK IN THE BBS! :(" && 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-${Debugfile}
    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}
fi
fi
cd ..
rm -rf php-${Ver}/
rm -rf php-${Ver}.tar.gz
rm -rf iconv_ins.sh
echo
echo "---------------------www.itbulu.com-------------------------------------"
echo "PHP UPDATE FINISH! :D"
echo "NOW YOUR PHP VERSION IS ${Ver}!"
echo "UPDATE SCRIPT MADE BY HTTP://WWW.AREFLY.COM & HTTP://WWW.ITBULU.COM "
echo "THANK YOU FOR USING"
echo
echo "WDCP (C) COPYRIGHT"
echo
echo "PS: I THINK YOU NEED RESTART SERVER AFTER UPDATE."
echo "PS2: REMEMBER TO VISIT HTTP://WWW.AREFLY.COM & HTTP://WWW.ITBULU.COM! :D"
echo





下面的是升级 zend guard7的脚本:

#!/bin/bash
case $1 in
"5.4")
        F="ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386"
        Aurl="http://downinfo.myhostadmin.net/guard/6.0.0"
        if [[ `uname -m` == "x86_64" ]];then
           F="ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64"
        fi
    F1=$F/php-5.4.x
;;
"5.5")
        F="zend-loader-php5.5-linux-i386"
        Aurl="http://downinfo.myhostadmin.net/guard/7.0.0"
        if [[ `uname -m` == "x86_64" ]];then
           F="zend-loader-php5.5-linux-x86_64"
        fi
    F1=$F
;;
"5.6")
        F="zend-loader-php5.6-linux-i386"
        Aurl="http://downinfo.myhostadmin.net/guard/7.0.0"
        if [[ `uname -m` == "x86_64" ]];then
           F="zend-loader-php5.6-linux-x86_64"
        fi
    F1=$F
;;
*)
echo "请执行sh Zendguard6.sh 5.4或5.5或5.6,暂不支持其他版本 "
exit
;;
esac

if [ ! -f $F ];then
    wget -c $Aurl/$F.tar.gz
fi
tar zxvf $F.tar.gz
[ $? != 0 ] && echo "file err" && exit
if [ ! -d /www/wdlinux/Zend/lib ];then
    mkdir -p /www/wdlinux/Zend/lib
fi
cp $F1/*.so /www/wdlinux/Zend/lib/
grep '\[Zend\]' /www/wdlinux/apache_php/etc/php.ini
if [ $? != 0 -a -f /www/wdlinux/apache_php/etc/php.ini ];then
echo '[Zend]
zend_extension = /www/wdlinux/Zend/lib/ZendGuardLoader.so
zend_loader.enable = 1' >> /www/wdlinux/apache_php/etc/php.ini
fi
grep '\[Zend\]' /www/wdlinux/nginx_php/etc/php.ini
if [ $? != 0 -a -f /www/wdlinux/nginx_php/etc/php.ini ];then
echo '[Zend]
zend_extension = /www/wdlinux/Zend/lib/ZendGuardLoader.so
zend_loader.enable = 1' >> /www/wdlinux/nginx_php/etc/php.ini
fi
echo
echo "ZendGuardLoader is OK"





下面是升级 mysql 的脚本:

#!/bin/bash
IN_DIR="/www/wdlinux"
MYS_VER="5.5.27"
if [ ! -f mysql-${MYS_VER}.tar.gz ];then
    wget -c http://dl.wdlinux.cn:5180/soft/mysql-${MYS_VER}.tar.gz
fi
yum install -y cmake
tar zxvf mysql-${MYS_VER}.tar.gz
cd mysql-${MYS_VER}
cmake -DCMAKE_INSTALL_PREFIX=$IN_DIR/mysql-$MYS_VER -DSYSCONFDIR=$IN_DIR/etc -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_SSL=no -DWITH_DEBUG=OFF -DWITH_EXTRA_CHARSETS=complex -DENABLED_PROFILING=ON -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1
[ $? != 0 ] && echo "configure err" && exit
make
[ $? != 0 ] && echo "make err" && exit
make install
[ $? != 0 ] && echo "make install err" && exit
service mysqld stop
if [ ! -d /www/wdlinux/mysql_bk ];then
mkdir -p /www/wdlinux/mysql_bk
cp -pR /www/wdlinux/mysql/var/* /www/wdlinux/mysql_bk
fi
rm -f /www/wdlinux/mysql
ln -sf $IN_DIR/mysql-$MYS_VER /www/wdlinux/mysql
sh scripts/mysql_install_db.sh --user=mysql --basedir=/www/wdlinux/mysql --datadir=/www/wdlinux/mysql/var
chown -R mysql.mysql /www/wdlinux/mysql/var
mv /www/wdlinux/mysql/var/mysql /www/wdlinux/mysql/var/mysqlo
cp -pR /www/wdlinux/mysql_bk/* /www/wdlinux/mysql/var/
cp support-files/mysql.server /www/wdlinux/init.d/mysqld
chmod 755 /www/wdlinux/init.d/mysqld
service mysqld restart
echo
if [ -d /www/wdlinux/mysql-5.1.63 ];then
    ln -sf /www/wdlinux/mysql-5.1.63/lib/mysql/libmysqlclient.so.16* /usr/lib/
fi
sleep 2
sh /www/wdlinux/tools/mysql_wdcp_chg.sh
echo
echo "mysql update is OK"


执行过程中,会出现类似这样的错误:

ERROR! MySQL server PID file could not be found!
Starting MySQL. ERROR! The server quit without updating PID file (/www/wdlinux/mysql-5.5.36/data/MyCloudServer.pid).

我们就需要解决这个问题,要不我们打开网站和WDCP面板之后是出现数据库链接错误。

vi /www/wdlinux/init.d/mysqld

找到下面两行:

basedir=

datadir=

然后替换成:

basedir=/www/wdlinux/mysql-5.5.27

datadir=/www/wdlinux/mysql-5.5.27/var

或者替换成:

basedir=/www/wdlinux/mysql

datadir=/www/wdlinux/mysql/var

然后重启service mysqld start数据库才可以。


浏览2867 评论0
返回
目录
返回
首页
CentOS安装LiteSpeed服务建站系列 - 安装LiteSpeed、MYSQL和PHP编译 LNMP网站环境一键部署及eAccelerator、xcache、ionCube组件安装