PHP Pecl Memcached module installation problems

I am using on several projects memcached and on the application side the php memcached module. This can be installed as any pear/pecl module, or from source by downloading the source .tgz and running the classic phpize; ./configure; make; make install; While trying to upgrade the memcached module to the latest version available 2.1.2 I encoutered a problem, receiving an error during the compile step: “configure: error: Cannot find php_session.h”

I am not sure if this error appears on different Linux distributions, but this happened for me on Debian Etch systems, running **PHP4 **but also with PHP5. Even if there is a pecl bug regarding this problem there is no patch or solution for it. Anyway… if you want to compile this version on Debian the solution is simple, and you will have to create a link from /usr/include/php{4/5} to /usr/include/php:

ln -s /usr/include/php4 /usr/include/php

or if you are running PHP5:

ln -s /usr/include/php5 /usr/include/php

This will allow the configure script to properly find the php_session.h include.

And in the end here is also the list of commands required to compile this module from source (don’t forget to create the link from above for your PHP version):

wget http://pecl.php.net/get/memcache-2.1.2.tgz
tar xvfz memcache-2.1.2.tgz
cd memcache-2.1.2
phpize
./configure
make
make install

or you can also use pear/pecl to install the module:

pecl install memcache

Note: in order to use the phpize command you need on to have installed the php development packages (on Debian the packages needed are php4-dev or php5-dev if you are using php5).

Once you installed the module you will need to enable it in php.ini, by adding:

extension=memcache.so
comments powered by Disqus