Skip to content
Permalink
Browse files

Merge branch '123.08centos6beta02redis' into 123.08centos7beta02

  • Loading branch information...
centminmod committed Apr 7, 2015
2 parents fe0079a + 7ff35c5 commit 18de7d8d8ed7f33a2bf2f5eaf785814dffb5b7f8
Showing with 190 additions and 0 deletions.
  1. +5 −0 centmin.sh
  2. +4 −0 inc/downloadlinks.inc
  3. +71 −0 inc/downloads.inc
  4. +21 −0 inc/php_upgrade.inc
  5. +89 −0 inc/redis.inc
@@ -325,6 +325,8 @@ MEMCACHEDPHP_VER='2.2.0' # Memcached PHP extension not server
LIBMEMCACHED_YUM='y' # switch to YUM install instead of source compile
LIBMEMCACHED_VER='1.0.18' # libmemcached version for source compile
TWEMPERF_VER='0.1.1'
PHPREDIS='y' # redis PHP extension install
REDISPHP_VER='2.2.7' # redis PHP version

FFMPEGVER='0.6.0'
SUHOSINVER='0.9.37.1'
@@ -412,6 +414,7 @@ source "inc/nginx_install.inc"
source "inc/nginx_upgrade.inc"
source "inc/imagick_install.inc"
source "inc/memcached_install.inc"
source "inc/redis.inc"
source "inc/mysql_proclimit.inc"
source "inc/mysqltmp.inc"
source "inc/mariadb_install.inc"
@@ -1124,6 +1127,8 @@ imagickinstall

geoipphpext

redisinstall

nsdinstall

pureftpinstall
@@ -187,6 +187,10 @@ PHPEXT_LIBMEMCACHEDLINKFILE="libmemcached-${LIBMEMCACHED_VER}.tar.gz"
PHPEXT_LIBMEMCACHEDLINK="https://launchpad.net/libmemcached/1.0/${LIBMEMCACHED_VER}/+download/${PHPEXT_LIBMEMCACHEDLINKFILE}"
PHPEXT_LIBMEMCACHEDLINKLOCAL="http://centminmod.com/centminmodparts/memcached/${PHPEXT_LIBMEMCACHEDLINKFILE}"

PHPEXT_REDISLINKFILE="phpredis-${REDISPHP_VER}.tgz"
PHPEXT_REDISLINK="https://github.com/phpredis/phpredis/archive/${REDISPHP_VER}.tar.gz"
PHPEXT_REDISLINKLOCAL="http://centminmod.com/centminmodparts/redis/${PHPEXT_MEMCACHEDLINKFILE}"

TWEMPERF_LINKFILE="twemperf-${TWEMPERF_VER}.tar.gz"
TWEMPERF_LINK="https://github.com/twitter/twemperf/archive/v${TWEMPERF_VER}.tar.gz"
# TWEMPERF_LINK="https://twemperf.googlecode.com/files/${TWEMPERF_LINKFILE}"
@@ -813,6 +813,77 @@ echo ""
fi
}

###############################################
redisphplocaltarball() {

cd $DIR_TMP
rm -rf redis*

cecho "Download local ${PHPEXT_REDISLINKFILE} ..." $boldyellow
if [ -s ${PHPEXT_REDISLINKFILE} ]; then
cecho "${PHPEXT_REDISLINKFILE} local found, skipping download..." $boldgreen
else
echo "Error: ${PHPEXT_REDISLINKFILE} not found !!! Download now......"
wget ${WGETOPT} --progress=bar --no-check-certificate ${PHPEXT_REDISLINKLOCAL} -O ${PHPEXT_REDISLINKFILE} --tries=3
ERROR=$?
if [[ "$ERROR" != '0' ]]; then
cecho "Error: ${PHPEXT_REDISLINKFILE} local download failed." $boldgreen
checklogdetails
exit #$ERROR
else
cecho "Download local done." $boldyellow
#echo ""
fi
fi

tar xzf ${PHPEXT_REDISLINKFILE}
ERROR=$?
if [[ "$ERROR" != '0' ]]; then
cecho "Error: ${PHPEXT_REDISLINKFILE} local extraction failed." $boldgreen
checklogdetails
exit #$ERROR
else
cecho "${PHPEXT_REDISLINKFILE} local valid file." $boldyellow
echo ""
fi
}

###############################################
redisphptarball() {

cd $DIR_TMP

cecho "Download ${PHPEXT_REDISLINKFILE} ..." $boldyellow
if [ -s ${PHPEXT_REDISLINKFILE} ]; then
cecho "${PHPEXT_REDISLINKFILE} found, skipping download..." $boldgreen
else
echo "Error: ${PHPEXT_REDISLINKFILE} not found !!! Download now......"
wget ${WGETOPT} --progress=bar --no-check-certificate ${PHPEXT_REDISLINK} -O ${PHPEXT_REDISLINKFILE} --tries=3
ERROR=$?
if [[ "$ERROR" != '0' ]]; then
cecho "Error: ${PHPEXT_REDISLINKFILE} download failed." $boldgreen
checklogdetails
exit #$ERROR
else
cecho "Download done." $boldyellow
#echo ""
fi
fi

tar xzf ${PHPEXT_REDISLINKFILE}
ERROR=$?
if [[ "$ERROR" != '0' ]]; then
cecho "Error: ${PHPEXT_REDISLINKFILE} extraction failed." $boldgreen
cecho "trying local mirror download..." $boldgreen
redisphplocaltarball
# checklogdetails
# exit #$ERROR
else
cecho "${PHPEXT_REDISLINKFILE} valid file." $boldyellow
echo ""
fi
}

###############################################
libmemcachedlocaltarball() {

@@ -33,6 +33,10 @@ if [[ -f ${CONFIGSCANDIR}/memcache.ini || -f ${CONFIGSCANDIR}/memcached.ini ]];
fi
fi

if [[ -f "${CONFIGSCANDIR}/redis.ini" || "$PHPREDIS" = [yY] ]]; then
DETECTREDIS=y
fi

if [ -f ${CONFIGSCANDIR}/zendopcache.ini ]; then
DETECTOPCACHE=y
fi
@@ -84,6 +88,11 @@ if [[ "$DETECTMEMCACHED" == [yY] ]]; then
funct_memcachedreinstall
fi

if [[ "$DETECTREDIS" == [yY] ]]; then
cecho "Auto reinstalling previously detected redis PHP extension" $boldyellow
redisinstall
fi

if [[ "$DETECTOPCACHE" == [yY] ]]; then
if [[ "$PHPMUVER" != '5.5' || "$PHPMUVER" != '5.6' || "$PHPMUVER" != '5.7' || "$PHPMUVER" != '7.0' ]]; then
cecho "Auto reinstalling previously detected Zend Opcache" $boldyellow
@@ -421,6 +430,12 @@ if [[ "$overwritephpfpmconf" = [yY] ]]; then
autodetectinstallextensions
fi

if [[ ! -f "${CONFIGSCANDIR}/redis.ini" && "$PHPREDIS" = [yY] ]]; then
redisinstall
elif [[ -f "${CONFIGSCANDIR}/redis.ini" && "$PHPREDIS" = [nN] ]]; then
rm -rf ${CONFIGSCANDIR}/redis.ini
fi

else

# only auto reinstall PHP extensions when major PHP upgrade version differs
@@ -429,6 +444,12 @@ else
autodetectinstallextensions
fi

if [[ ! -f "${CONFIGSCANDIR}/redis.ini" && "$PHPREDIS" = [yY] ]]; then
redisinstall
elif [[ -f "${CONFIGSCANDIR}/redis.ini" && "$PHPREDIS" = [nN] ]]; then
rm -rf ${CONFIGSCANDIR}/redis.ini
fi

fi # overwritephpfpmconf

zendopcacheextfix
@@ -0,0 +1,89 @@
#######################################################
checkredistar() {

cecho "Check if ${PHPEXT_REDISLINKFILE} exists" $boldyellow
if [ ! -f "${DIR_TMP}/${PHPEXT_REDISLINKFILE}" ]; then

cecho "Downloading redis PHP extension.." $boldgreen

redisphptarball
fi

}

checkigbinary() {

PHPEXTDIRD=`cat /usr/local/bin/php-config | awk '/^extension_dir/ {extdir=$1} END {gsub(/\047|extension_dir|=|)/,"",extdir); print extdir}'`

cecho "Checking for igbinary.so ..." $boldgreen

cecho "Check if ${PHPEXTDIRD}/igbinary.so exists" $boldyellow
if [ ! -f "${PHPEXTDIRD}/igbinary.so" ]; then
funct_igbinaryinstall
fi

if [[ ! -f ${CONFIGSCANDIR}/igbinary.ini ]]; then
funct_igbinaryinstall
#echo "will need to reinstall memcached extensions if needed"
fi

# check for different igbinary versions

if [ -f /usr/local/bin/php ]; then
if [[ "$(php --ri igbinary | awk '/igbinary version/ {print $4}')" != "${IGBINARY_VERSION}" ]]; then
funct_igbinaryinstall
fi
fi

}

#######################################################
redisinstall() {

PHPEXTDIRD=`cat /usr/local/bin/php-config | awk '/^extension_dir/ {extdir=$1} END {gsub(/\047|extension_dir|=|)/,"",extdir); print extdir}'`

echo "*************************************************"
cecho "* Installing redis PHP extension" $boldgreen
echo "*************************************************"
echo "Downloading redis PHP extension..."
cd $DIR_TMP

checkigbinary

checkredistar

cecho "Compiling PHP redis-${REDISPHP_VER} extension..." $boldgreen

pwd
echo "cd $DIR_TMP"
cd $DIR_TMP
#tar xvzf ${PHPEXT_REDISLINKFILE}
cd ${DIR_TMP}/phpredis-${REDISPHP_VER}
make clean
/usr/local/bin/phpize
if [[ -f "${PHPEXTDIRD}/igbinary.so" ]]; then
./configure --with-php-config=/usr/local/bin/php-config --enable-redis-igbinary
else
./configure --with-php-config=/usr/local/bin/php-config
fi
make${MAKETHREADS}
make install

#######################################################
# check to see if redis.so already loaded in php.ini

REDISSOCHECK=`grep 'redis.so' /usr/local/lib/php.ini`
REDISSOCHECKB=$(grep 'redis.so' ${CONFIGSCANDIR}/redis.ini)
PHPEXTDIRD=`cat /usr/local/bin/php-config | awk '/^extension_dir/ {extdir=$1} END {gsub(/\047|extension_dir|=|)/,"",extdir); print extdir}'`

if [[ -z "$REDISSOCHECK" || -z "$REDISSOCHECKB" ]]; then
#echo "" >> /usr/local/lib/php.ini
echo "extension=redis.so" > ${CONFIGSCANDIR}/redis.ini
else
echo ""
echo "redis.so already loaded in ${CONFIGSCANDIR}/redis.ini"
echo "$REDISSOCHECK"
echo ""
fi # redis.so check

}

0 comments on commit 18de7d8

Please sign in to comment.
You can’t perform that action at this time.