sh 在cPanel / WHM服务器上安装Memcached(服务和相关的PHP模块)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh 在cPanel / WHM服务器上安装Memcached(服务和相关的PHP模块)相关的知识,希望对你有一定的参考价值。

#!/bin/bash

# Memcached (service & related PHP modules) installation on cPanel/WHM servers
#
# by Fotis Evangelou (Engintron)
#
# Updated: May 2018
#
# USAGE:
# Upload this file at the root (/) folder of your cPanel/WHM server (on CentOS 7)
# and make it executable with: $ chmod +x /memcached_installer_for_cpanel.sh
#
# Then execute it with:
# $ /memcached_installer_for_cpanel.sh
#
# To define a different cache pool size (e.g. 512M), execute with:
# $ /memcached_installer_for_cpanel.sh 512M
#
# Enjoy!

CACHE_SIZE="256M"

if [[ $1 ]]; then
    CACHE_SIZE=$1
fi

clear

echo " ****************************************************"
echo " *               Installing Memcached               *"
echo " ****************************************************"

# Let's update the system first
yum clean all
yum -y update
yum -y upgrade

# Install memcached & start it
yum -y install memcached memcached-devel ea4-experimental
service memcached start
chkconfig memcached on

# Adjust its cache size to 512M & restart
if [ -e "/etc/sysconfig/memcached" ]; then
    sed -i 's/CACHESIZE=.*/CACHESIZE="'${CACHE_SIZE}'"/' /etc/sysconfig/memcached
fi
service memcached restart

# Install related PHP modules for PHP versions 5.6 to 7.2
yum -y install ea-php56-php-memcached ea-php70-php-memcached ea-php71-php-memcached ea-php72-php-memcached

# Finish things up by restarting web services
service memcached restart

# Restart Apache & PHP-FPM
if [ "$(pstree | grep 'httpd')" ]; then
    echo "Restarting Apache..."
    /scripts/restartsrv apache_php_fpm
    /scripts/restartsrv_httpd
    echo ""
fi

# Restart Nginx (if it's installed via Engintron)
if [ "$(pstree | grep 'nginx')" ]; then
    echo "Restarting Nginx..."
    service nginx restart
    echo ""
fi

# Print out useful info
memcached -h
php -i | grep -i memcache

echo " ****************************************************"
echo " *         Memcached installation complete          *"
echo " ****************************************************"

以上是关于sh 在cPanel / WHM服务器上安装Memcached(服务和相关的PHP模块)的主要内容,如果未能解决你的问题,请参考以下文章

主机名未解析为 IP WHM/cPanel

在 cPanel 服务器上安装 git

使用 WHM/Cpanel 通过 PHP 创建电子邮件

markdown 安装Imagick on centos whm - cpanel

如何在 Cpanel/WHM 中安装 OCI8 扩展以连接 Oracle 数据库?

Cpanel 和 whm 被黑了,但是