Configure Memcache with PHP Shell Script on Linux
July 30 2015
We have already discussed how to configure Memcached with PHP on Linux manually, this post will help you configure short time.
Create a file name memcache-php.sh, copy and paste the following script line,
# vim /root/memcache-php.sh
#Download and Install Repository
rpm -Uhv https://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
#Update and install memcached
yum update -y
yum install memcached -y
wget http://pecl.php.net/get/memcache-3.0.8.tgz -O /usr/local/src
cd /usr/local/src
tar -xf memcache-3.0.8.tgz
cd memcache-3.0.8
/usr/bin/phpize && ./configure --enable-memcache && make && make install
#extension=memcache.so added into php.ini
if [ -f /etc/php.ini ]; then
echo "extension="memcache.so"" >> /etc/php.ini
else
echo "php.ini file could not found"
echo "Enter the php.ini configure file location"
read $FILE_LOCATION
echo "extension="memcache.so"" >> $FILE_LOCATION
fi
#Restart Memcahced
service memcached restart
chkconfig memcached on
echo "Now Memcached installed and configured with PHP Successfully"
Echo "Configured Output"
php -i | grep memcache
Finally give execute permission and run the script,
# chmod +x /root/memcache-php.sh
# sh /root/memcache-php.sh
# sh /root/memcache-php.sh
Comments (0)