<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Dotdeb &#187; memcached</title>
	<atom:link href="http://www.dotdeb.org/tag/memcached/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dotdeb.org</link>
	<description>The repository for Debian-based LAMP servers</description>
	<lastBuildDate>Fri, 03 Feb 2012 01:25:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Storing your PHP sessions using memcached</title>
		<link>http://www.dotdeb.org/2008/08/25/storing-your-php-sessions-using-memcached/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=storing-your-php-sessions-using-memcached</link>
		<comments>http://www.dotdeb.org/2008/08/25/storing-your-php-sessions-using-memcached/#comments</comments>
		<pubDate>Mon, 25 Aug 2008 09:02:46 +0000</pubDate>
		<dc:creator>Guillaume Plessis</dc:creator>
				<category><![CDATA[Documentation]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[memcached]]></category>

		<guid isPermaLink="false">http://www.dotdeb.org/?p=85</guid>
		<description><![CDATA[Using PHP sessions can be a problem when your PHP applications are load-balanced on many web servers. You can store them on a NFS export or recode the session_set_save_handler using a SQL backend for example. But there is no solution more efficient, more scalable, more performant and easier to deploy than using memcached&#8230; Memcached is a [...]]]></description>
			<content:encoded><![CDATA[<p>Using PHP sessions can be a problem when your PHP applications are load-balanced on many web servers. You can store them on a NFS export or recode the <a href="http://www.php.net/manual/en/function.session-set-save-handler.php">session_set_save_handler</a> using a SQL backend for example. But there is no solution more efficient, more scalable, more performant and easier to deploy than using memcached&#8230;</p>
<blockquote><p><a href="http://www.danga.com/memcached/">Memcached</a> is a high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load&#8230;</p></blockquote>
<p>Many well-known huge architecture (Facebook, Livejournal, Youtube&#8230;) are using it as memory caching to reduce the load on their servers. It can also be used to share PHP sessions among several servers. Let&#8217;s see how&#8230;</p>
<p><strong>Installation</strong></p>
<p>The first thing is to install the memcached server on your Debian server :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> memcached</pre></div></div>

<p>Then, since the <a href="http://pecl.php.net/package/memcache">memcache PECL extension</a> now provides its own session handler, it&#8217;s easy to plug PHP and memcached servers. Just install the appropriate extension (from Dotdeb) :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> php5-memcache</pre></div></div>

<p>and change some of your PHP settings :</p>

<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;">session.save_handler <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> files</span>
<span style="color: #666666; font-style: italic;">; session.save_path = &quot;N;/path&quot;</span></pre></div></div>

<p>to :</p>

<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;">session.save_handler <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> memcache</span>
<span style="color: #666666; font-style: italic;">; change server:port to fit your needs...</span>
session.save_path<span style="color: #000066; font-weight:bold;">=</span><span style="color: #933;">&quot;tcp://server:port?persistent=1&amp;amp;weight=1&amp;amp;timeout=1&amp;amp;retry_interval=15&quot;</span></pre></div></div>

<p>That&#8217;s all! After relaunching your Apache2 server, your PHP sessions will be stored on the memcached server.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dotdeb.org/2008/08/25/storing-your-php-sessions-using-memcached/feed/</wfw:commentRss>
		<slash:comments>55</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using apc
Database Caching 1/15 queries in 0.003 seconds using apc
Object Caching 194/227 objects using apc

Served from: www.dotdeb.org @ 2012-02-04 04:53:15 -->
