note 85770 added to memcache.installation

From: Date: Wed, 17 Sep 2008 04:11:21 +0000
Subject: note 85770 added to memcache.installation
Groups: php.notes 
Request: Send a blank email to php-notes+get-144467@lists.php.net to get a copy of this message
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! ---- Server IP: 89.31.146.176 Probable Submitter: 75.144.87.138 ---- Manual Page -- http://www.php.net/manual/en/memcache.installation.php Edit -- https://master.php.net/note/edit/85770 Del: integrated -- https://master.php.net/note/delete/85770/integrated Del: useless -- https://master.php.net/note/delete/85770/useless Del: bad code -- https://master.php.net/note/delete/85770/bad+code Del: spam -- https://master.php.net/note/delete/85770/spam Del: non-english -- https://master.php.net/note/delete/85770/non-english Del: in docs -- https://master.php.net/note/delete/85770/in+docs Del: other reasons-- https://master.php.net/note/delete/85770 Reject -- https://master.php.net/note/reject/85770 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#144467) next »