Jun 132011

I have found a very cool program for monitoring and debugging Memcached server, it’s called  phpMemcachedAdmin. This program allows to see in real-time (top-like) or from the start of the server, stats for get, set, delete, increment, decrement, evictions, reclaimed, cas command, as well as server stats (network, items, server version) with googlecharts and server internal configuration You can go further to see each server slabs, occupation, memory wasted and items (key & value).

Another part can execute commands to any memcached server : get, set, delete, flush_all, as well as execute any commands (like stats) with telnet To extract these informations, phpMemCacheAdmin uses, as you wish, direct communication with server, PECL Memcache or PECL Memcached API.

Explanation above is an excerpt from the website. This is a simple guide how do I install phpMemCachedAdmin.

Download phpMemCachedAdmin tarball

# wget http://phpmemcacheadmin.googlecode.com/files/phpMemcachedAdmin-1.2.1-r233.tar.gz

Since we will install in /var/www/html/memcached/ directory, run this command:

# mkdir -p /var/www/html/memcached
# tar -xvzf phpMemcachedAdmin-1.2.1-r233.tar.gz -C /var/www/html/memcached/
# chmod 0777 /var/www/html/memcached/Config/Memcache.php

Apache Configuration

( i’m using apache as reverse proxy backend )

# cd /etc/httpd/conf.d
# vi memcached.conf


<VirtualHost *:80>
	ServerName   memcached.example.com
	UseCanonicalName Off
	ServerAdmin  "webmaster@example.com"
	DocumentRoot "/var/www/html/memcached"
	CustomLog  /var/log//httpd/memcached.example.com-access_log common
	ErrorLog   /var/log/httpd/memcached.example.com-error_log

In the actual configuration, Apache only listens on ip address
Restart apache:

# service httpd restart

Nginx Configuration

( reverse proxy front end )

# cd /etc/nginx/conf.d
# vi memcached.conf

Because phpMemCachedAdmin not protected with user / pass or other protection mechanisms by default, we will restrict access based on ip address. This is the easiest way. 😀


server {
	listen 80;
		server_name  memcached.example.com;
		access_log   /var/log/nginx/memcached.example.com-access.log  main;

		location  / {
			allow my.private.ip.address/32;
			deny all;
			proxy_set_header Host $host;
			proxy_set_header X-Real-IP $remote_addr;
			proxy_set_header X-Forwarded-Host $host;
			proxy_set_header X-Forwarded-Server $host;
			proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

Restart nginx

#service nginx restart

These are examples of phpMemCachedAdmin screenshots

  9 Responses to “Monitoring And Debugging Memcached Server Using phpMemCachedAdmin”

Comments (9)
  1. Hello,
    I want to use just nginx that is installed in a system to view PhpMemcachedAdmin dashboard.
    I extracted all files under /var/www/html/memcached, gave the appropriate permissions to folders and files and I had setup the following vhost:
    server {
    listen 8032;
    server_name memcachedadmin.charazay.com;
    access_log /var/log/nginx/phpMemCachedAdmin-access.log;
    index index.php;

    location / {
    root /var/www/html/memcached;
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    include /etc/nginx/php.conf;
    default_type text/html;

    However, when I access memcachedadmin.charazay.com:8032 I get an “Access denied” message. What am I doing wrong? Thank in advance!

  2. check your files pwrmission. are they belong to nginx?at least when you’re using php-cgi, php-cgi shloud be has read pesmission to the files.

  3. All files have read permissions from anybody.

  4. I use Memcache API and phpMemcachedAdmin 1.2.2
    if I want to add a string with length 110 my script read it well but admin GUI read like “x�+,,WH,NIL`��

    but if string length is 3 GUI read well what is problem?

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>




This site uses Akismet to reduce spam. Learn how your comment data is processed.