I built PHP from source with configure command

'./configure' '--prefix=/usr/local/php-5.2.8' '--with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d' '--with-apxs2=/usr/local/httpd/bin/apxs' '--with-mysql=/usr/local/mysql/' '--with-zlib' 

I installed php memcache extension :

wget http://pecl.php.net/get/memcache
tar -zxvf memcache-2.2.5.tgz
cd memcache-2.2.5
./configure --enable-memcache
make install

I add to my /usr/local/lib/php.in


Rebooted my apache and run php-m but php seem doesn't load memcache extension I followed this solution from this site http://www.howtoforge.com/forums/showthread.php?t=26554

I added full path


rebooted apache But it didn't load memcache extension ! I google around but the same issue ! How can I load this extension _ _"


Firstly run your php binary like

php -v

It should complain that your php.ini wants to load modules that cant be loaded...

If it doesnt complain, run

php --ini

This should give you the location of your php.ini ( just incase your editing the wrong one :D )

Did this help?


The problem is..., at this point: wget http://pecl.php.net/get/memcache Instead of tar -zxvf memcache-2.2.5.tgz, you should do tar -zxvf memcache (this is the filename from wget).

After you extract the file, you will get the latest version of memcache, at the time I do this, I get the folder memcache-3.0.8.

So, the next steps will be:

cd memcache-3.0.8 
./configure --enable-memcache 
make install

And finally , dont forget to add this line to your php.ini:

extension = memcache.so

And restart Apache.


Are you sure memcached is installed in the correct location? What do you get if you run: locate memcache.so

Is memcached installed (the binary)? Does it require any extra libraries (libmemcache)?

  • You should use find, not locate, given that it may not yet be in the locate db. – Cian Sep 14 '09 at 11:33
  • The memcached daemon is installed successfull! and when I locate the memcache extension locate memcache.so /usr/local/lib/php/extensions/no-debug-non-zts-20060613/memcache.so /usr/local/src/memcache-2.2.5/.libs/memcache.so /usr/local/src/memcache-2.2.5/modules/memcache.so I think the problem is php didn't load the extension ! – billyduc Sep 15 '09 at 2:39

Add an extension_dir directive to tell PHP where to load extensions from and remove the path from the extension directive.

extension = memcache.so
extension_dir = /usr/local/lib/php/extensions/no-debug-non-zts-20060613
  • poor me ! It doesn't work ! – billyduc Sep 30 '09 at 4:00

One thing that helped me is to use

pecl uninstall memcache
pecl install memcache

Another thing (this applies only to rather old php versions though): http://www.hollub.at/phpmanual/ref.memcache.html says:

In order to use these functions you must compile PHP with Memcache support by using the --enable-memcache[=DIR] option. 

this is because of your /var/tmp mounted with noexec permission

you can try to recompile memcache using fuenfundachtzig command after temporarily delete /var/tmp symlink and create new /var/tmp folder. (this setting maybe differ from your server)

#rm /var/tmp
#mkdir /var/tmp

#pecl install memcache

then secure back your temp folder

#rm -rf /var/tmp
#ln -s /tmp /var/tmp

read more about securing tmp here

and how to use PECL with tmp mounted with noexec


If you have your PHP compiled, try to remove extension_dir from your php.ini.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.