Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
oneinstack 使用 PGO 编译的升级文件
#!/bin/bash
# Author: yeho <lj2007331 AT gmail.com>
# BLOG: https://blog.linuxeye.com
#
# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
#
# Project home page:
# https://oneinstack.com
# https://github.com/lj2007331/oneinstack
Upgrade_PHP() {
cd $oneinstack_dir/src
[ ! -e "$php_install_dir" ] && echo "${CWARNING}PHP is not installed on your system! ${CEND}" && exit 1
echo
OLD_PHP_version=`$php_install_dir/bin/php -r 'echo PHP_VERSION;'`
echo "Current PHP Version: ${CMSG}$OLD_PHP_version${CEND}"
while :; do echo
read -p "Please input upgrade PHP Version: " NEW_PHP_version
if [ "${NEW_PHP_version%.*}" == "${OLD_PHP_version%.*}" ]; then
[ ! -e "php-$NEW_PHP_version.tar.gz" ] && wget --no-check-certificate -c http://www.php.net/distributions/php-$NEW_PHP_version.tar.gz > /dev/null 2>&1
if [ -e "php-$NEW_PHP_version.tar.gz" ];then
echo "Download [${CMSG}php-$NEW_PHP_version.tar.gz${CEND}] successfully! "
else
echo "${CWARNING}PHP version does not exist! ${CEND}"
fi
break
else
echo "${CWARNING}input error! ${CEND}Please only input '${CMSG}${OLD_PHP_version%.*}.xx${CEND}'"
fi
done
if [ -e "php-$NEW_PHP_version.tar.gz" ];then
echo "[${CMSG}php-$NEW_PHP_version.tar.gz${CEND}] found"
echo "Press Ctrl+c to cancel or Press any key to continue..."
char=`get_char`
tar xzf php-$NEW_PHP_version.tar.gz
src_url=http://mirrors.linuxeye.com/oneinstack/src/fpm-race-condition.patch && Download_src
patch -d php-$NEW_PHP_version -p0 < fpm-race-condition.patch
cd php-$NEW_PHP_version
make clean
$php_install_dir/bin/php -i |grep 'Configure Command' | awk -F'=>' '{print $2}' | bash
make prof-gen ZEND_EXTRA_LIBS='-liconv'
sapi/cgi/php-cgi -T 1000 /data/wwwroot/mf8/index.php >/dev/null
make prof-clean
echo "Stoping php-fpm..."
service php-fpm stop
make prof-use ZEND_EXTRA_LIBS='-liconv'
make install
cd ..
echo "Starting php-fpm..."
service php-fpm start
echo "You have ${CMSG}successfully${CEND} upgrade from ${CWARNING}$OLD_PHP_version${CEND} to ${CWARNING}$NEW_PHP_version${CEND}"
fi
cd ..
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment