memcached on centos

Below is a summary of steps taken to get memcache support for php:

1. Install memcached and php-pear for pecl support to download and compile memcache for php.

    yum --enablerepo=epel install memcached php-pear
    pecl install memcache

2. Configure memcached (/etc/sysconfig/memcached) and start it up:

    chkconfig memcached on
    service memcached start

3. Create /etc/php.d/memcache.ini file with the below contents:

    extension=memcache.so

4. Reload apache and/or php-fpm processes:

    service httpd reload
    service php-fpm restart

5. Check with "php -i" or "phpinfo()" that memcache support is enabled.

6. Memcached listens to port 11211 by default. Status and stats:

    memcached-tool localhost:11211 display
    memcached-tool localhost:11211 stats

Comment