Installing Memcached and PHP Memcache on CentOS and Ubuntu



On CentOS:

Install Memcached
_ yum install memcached
_ /sbin/chkconfig memcached on
_ /etc/init.d/memcached start
_ vim /etc/sysconfig/memcached, and edit:
OPTIONS=”-l 127.0.0.1″

Install PHP extension for Memcache:
_ yum install zlib-devel
This will prevent this error from occurring:
configure: error: memcache support requires ZLIB. Use –with-zlib-dir=<DIR> to specify prefix where ZLIB include and library are located
_ pear install pecl/memcache
You should have:
/usr/lib/php/modules/memcache.so
_ echo “extension=memcache.so” > /etc/php.d/memcache.ini
_ /etc/init.d/httpd restart

On Ubuntu:

I’ve installed: apt-get install php5-memcache
I also have memcached installed: apt-get install memcached
restart apache
start memcached

Tags:

Leave a Reply

You must be logged in to post a comment.