Installing and setting up the Memcached server
Memcached is available as a ready-made package in the Remi repository.
So lets install the Remi repository first:
Memcached server install
yum --enablerepo=remi install memcached
Edit and use the RPM start script
#adapt options here, like memory available
# start service
service memcached start
# add to system boot config
chkconfig memcached on
Making it more secure
It’s a good idea to add an IpTables rule to block all outside requests to this server. Add a line like this to your
-A INPUT -p tcp --dport 11211 -j ACCEPT
Testing your Memcached server
# Is the service running?
netstat -tap | grep memcached
You should see an output that look something like this:
tcp 0 0 *:11211 *:* LISTEN 29441/memcached tcp 0 0 *:11211 *:* LISTEN 29441/memcached
# see some stats with memcached-tool (installed along with RPM):
memcached-tool 127.0.0.1:11211 stats
#127.0.0.1:11211 Field Value
Please see the note on the bottom if you plan on using this on Joomla!
yum --enablerepo=remi install zlib zlib-devel yum --enablerepo=remi install libmemcached libmemcached-devel pecl install memcached
Add this line to your php.ini
If you create an test.php file (calling phpinfo() )(after restarting Apache), it should look like this:
Create the file test.php file
or use a test editor and FTP it up.
Insert this into the file.
<?php phpinfo(); ?>
Open the file in your browser:
It should look like this:
After I set this up on our server and tried to use it on Joomla ( Joomla 2.5 at the time of writing ), Joomla did not have the capability to use the memcacheD php client, but only the memcache php client.
To install the memcache client and not the memcacheD client execute:
pecl install memcache
and place this line into your php.ini
rather than the memcacheD commands.