downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | conferences | my php.net

search for in the

Runtime Configuration> <Requirements
[edit] Last updated: Thu, 20 Jun 2013

view this page in

Installation

This » PECL extension is not bundled with PHP. Information for installing this PECL extension may be found in the manual chapter titled Installation of PECL extensions. Additional information such as new releases, downloads, source files, maintainer information, and a CHANGELOG, can be located here: » http://pecl.php.net/package/memcache.

Note:

It's possible to disable memcache session handler support. The 'pecl install' option prompts for this (default is enabled) however when compiling statically into PHP the --disable-memcache-session configure option may be used.



Runtime Configuration> <Requirements
[edit] Last updated: Thu, 20 Jun 2013
 
add a note add a note User Contributed Notes Installation - [8 notes]
up
2
mit at mitayai dot org
3 years ago
It is very important to note when reading the information supplied by others on this page that there are two *distinct* memcache PHP implementations for the service "memcached".

1) pecl-memcache
2) pecl-memcached

This page is for the first, pecl-memcache.

If you are looking for pecl-memcached information, visit here:

http://www.php.net/manual/en/book.memcached.php
up
0
andryzeus at ukr dot net
1 year ago
If you have error with libtool version after make - way to install:
phpize --clean && phpize
rm aclocal.m4
aclocal
autoconf
./configure
make
make install
[memcache-2.2.6, gentoo.x86-64]
up
0
no at spam4me dot com
3 years ago
#if apt-get, rpm, or yum doesn't work
cd /usr/src/
wget http://pecl.php.net/get/memcache-2.2.4.tgz
tar -zxvf memcached-2.2.4.tgz
cd memcached-2.2.4
phpize && ./configure --enable-memcache && make
cp modules/memcache.so /usr/lib/php/modules/

# Note: packaged extension modules are now loaded via the .ini files
# found in the directory /etc/php.d
touch /etc/php.d/memcached.ini
echo 'extension=memcache.so' > /etc/php.d/memcached.ini

service httpd restart
up
0
mykel dot alvis at gmail dot com
5 years ago
on Fedora, apparently

yum install php-pecl-memcache
up
0
Wayne
5 years ago
Newer PHP versions don't have a --enable-memcache options; simply installing the PECL package will be enough... so to be absolutely clear, you WON'T have to recompile PHP to use memcache.  That paragraph above seems like a bad case of earlier version documentation editing.
up
-1
Felipe Estrella Barros
1 year ago
On Slackware, after copilling it, you should copy the file /module/memcache.so to /usr/lib/httpd/modules. Then, the instruction extension=memcache.so must be added into the file /etc/httpd/php.ini

Restart the httpd and it should work!
up
-2
pesdguy at yahoo dot co dot in
3 years ago
For xampp if you need to install memcache

use this place for all version
:
http://downloads.php.net/pierre/
up
-3
djfobbz at gmail dot com
4 years ago
Installing PHP5 Memcache Extension Module on Ubuntu (note: you must have memcached installed prior to installing this extension module.  refer to prerequisite install below):

-------------------------
# Prerequisite Install
-------------------------
# Download & install libevent (memcached dependency)
wget http://www.monkey.org/~provos/libevent-1.4.8-stable.tar.gz
tar xfz libevent-1.4.8-stable.tar.gz
cd libevent-1.4.8-stable
./configure && make && sudo make install

# Create a symlink to libevent
sudo ln -s /usr/local/lib/libevent-1.4.so.2 /usr/lib

# Download & install memcached
wget http://danga.com/memcached/dist/memcached-1.2.6.tar.gz
tar xfz memcached-1.2.6.tar.gz
cd memcached-1.2.6
./configure && make && sudo make install

# Run memcached as a daemon (d = daemon, m = memory, u = user, l = IP to listen to, p = port)
memcached -d -m 1024 -u root -l 127.0.0.1 -p 11211

-------------------------
# PHP5-Memcache Install
-------------------------
# Download the extension module
apt-get install php5-memcache

# Edit /etc/php5/conf.d/memcache.ini and uncomment the following line by removing the semi-colon
extension=memcache.so

# Restart apache
/etc/init.d/apache2 restart

-------------------------
# Test Install
-------------------------
# Create a file 'memcache_test.php' in your webroot and paste the following:
<?php
$memcache
= new Memcache;
$memcache->connect('localhost', 11211) or die ("Could not connect");

$version = $memcache->getVersion();
echo
"Server's version: ".$version."<br/>\n";

$tmp_object = new stdClass;
$tmp_object->str_attr = 'test';
$tmp_object->int_attr = 123;

$memcache->set('key', $tmp_object, false, 10) or die ("Failed to save data at the server");
echo
"Store data in the cache (data will expire in 10 seconds)<br/>\n";

$get_result = $memcache->get('key');
echo
"Data from the cache:<br/>\n";

var_dump($get_result);
?>

# Test to see if the file renders in your browser

Cheers!

 
show source | credits | sitemap | contact | advertising | mirror sites