Installing memcache on PHP with CentOS 6

I was following the instructions here to install memcache on a CentOS 6 server that I’m currently configuring. I was able to install the base memcache rpm, but had trouble when installing the PECL extension for PHP.

The first error I got had something to do with not being able to phpize the script.

So, I ran the following command to install the php development package:

yum install php-devel

Then I re-ran the PECL memcached install and came across this message:

checking for the location of zlib… configure: error: memcache support requires ZLIB. Use –with-zlib-dir=<DIR>

And finally found a solution for this by running this command to install the zlib-devel package:

yum install zlib-devel

Now you should be able to successfully install and add the memcache extension to your php.ini. Follow the instructions linked above for more information.