<?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>all your code are belong to us &#187; memcache</title>
	<atom:link href="http://allurcode.com/tag/memcache/feed/" rel="self" type="application/rss+xml" />
	<link>http://allurcode.com</link>
	<description>and all my code are belong to you</description>
	<lastBuildDate>Thu, 19 Jan 2012 20:33:59 +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>PHP session handling with memcache</title>
		<link>http://allurcode.com/2010/03/16/php-session-handling-with-memcache/</link>
		<comments>http://allurcode.com/2010/03/16/php-session-handling-with-memcache/#comments</comments>
		<pubDate>Tue, 16 Mar 2010 11:53:41 +0000</pubDate>
		<dc:creator>6bytes</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[memcache]]></category>
		<category><![CDATA[session]]></category>

		<guid isPermaLink="false">http://allurcode.com/?p=185</guid>
		<description><![CDATA[In last two posts I described how to install memcached daemon and memcache extension for PHP. Today I&#8217;ll show you how to configure your PHP to use memcache to handle sessions. One thing I should mention is that when installing memcache you should answer yes when asked First of all lets start two memcached processes [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>In last two posts I described how to install <a href="http://allurcode.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2FsbHVyY29kZS5jb20vMjAxMC8wMy8xMy9ob3ctdG8taW5zdGFsbC1tZW1jYWNoZWQtb24tY2VudG9zLw==">memcached</a> daemon and <a href="http://allurcode.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2FsbHVyY29kZS5jb20vMjAxMC8wMy8xMy9ob3ctdG8tcnVuLW1lbWNhY2hlLWluLXBocC8=">memcache</a> extension for PHP. Today I&#8217;ll show you how to configure your PHP to use memcache to handle sessions.</p>
<p>One thing I should mention is that when installing memcache you should answer <strong><em>yes</em></strong> when asked</p>
<pre class="brush: bash; title: ; notranslate">1. Enable memcache session handler support? : yes</pre>
<p>First of all lets start two memcached processes just in case one crashes, we&#8217;ll have a second one ready right away.</p>
<pre class="brush: bash; title: ; notranslate">
memcached -u root -d -m 512 -l 127.0.0.1 -p 11211
memcached -u root -d -m 512 -l 127.0.0.1 -p 11212
</pre>
<p>Worth mentioning is that when one memcached process crashes session information will not be transferred to another. New session will be started.</p>
<p>Next edit your php.ini file. Comment the line with your current session handler setting</p>
<pre class="brush: bash; title: ; notranslate">; session.save_handler = files</pre>
<p>and add two new lines</p>
<pre class="brush: bash; title: ; notranslate">
session.save_handler = memcache
session.save_path = &quot;tcp://localhost:11211, tcp://localhost:11212&quot;
</pre>
<p>If for any reason you don&#8217;t want to edit php.ini file you can set those options directly in your PHP script.</p>
<pre class="brush: bash; title: ; notranslate">
ini_set('session.save_handler', 'memcache');
ini_set('session.save_path', 'tcp://localhost:11211, tcp://localhost:11212');
</pre>
<p>Restart your web server</p>
<pre class="brush: bash; title: ; notranslate">service httpd restart</pre>
<p>For full list of runtime configuration options go <a href="http://allurcode.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5waHAubmV0L21hbnVhbC9lbi9tZW1jYWNoZS5pbmkucGhw">here</a>.</p>
<div class="shr-publisher-185"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href="http://allurcode.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cCUzQSUyRiUyRmFsbHVyY29kZS5jb20lMkYyMDEwJTJGMDMlMkYxNiUyRnBocC1zZXNzaW9uLWhhbmRsaW5nLXdpdGgtbWVtY2FjaGUlMkY=" data-shr_title='PHP+session+handling+with+memcache'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href="http://allurcode.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cCUzQSUyRiUyRmFsbHVyY29kZS5jb20lMkYyMDEwJTJGMDMlMkYxNiUyRnBocC1zZXNzaW9uLWhhbmRsaW5nLXdpdGgtbWVtY2FjaGUlMkY=" data-shr_title='PHP+session+handling+with+memcache'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom Automatic --> <img src="http://allurcode.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=185" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://allurcode.com/2010/03/16/php-session-handling-with-memcache/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to run memcache in PHP</title>
		<link>http://allurcode.com/2010/03/13/how-to-run-memcache-in-php/</link>
		<comments>http://allurcode.com/2010/03/13/how-to-run-memcache-in-php/#comments</comments>
		<pubDate>Sat, 13 Mar 2010 01:51:11 +0000</pubDate>
		<dc:creator>6bytes</dc:creator>
				<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[memcache]]></category>

		<guid isPermaLink="false">http://allurcode.com/?p=156</guid>
		<description><![CDATA[After installing memcached daemon we have to install memcache PHP extension. or If above is not an option try below method. After successful installation add memcache.so extension to your php.ini file. Add this line: Restart web server Test out our installation. You should see your server&#8217;s version number. If you see a blank page make [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>After installing <a href="http://allurcode.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2FsbHVyY29kZS5jb20vMjAxMC8wMy8xMy9ob3ctdG8taW5zdGFsbC1tZW1jYWNoZWQtb24tY2VudG9zLw=="><strong>memcached</strong></a> daemon we have to install memcache PHP extension.</p>
<pre class="brush: bash; title: ; notranslate">yum install php-pecl-memcache</pre>
<p>or</p>
<pre class="brush: bash; title: ; notranslate">apt-get install php5-memcache</pre>
<p>If above is not an option try below method.</p>
<pre class="brush: bash; title: ; notranslate">pecl install memcache</pre>
<p>After successful installation add <strong>memcache.so</strong> extension to your <strong>php.ini</strong> file.</p>
<pre class="brush: bash; title: ; notranslate">vim /etc/php.ini</pre>
<p>Add this line:</p>
<pre class="brush: bash; title: ; notranslate">extension=memcache.so</pre>
<p>Restart web server</p>
<pre class="brush: bash; title: ; notranslate">service httpd restart</pre>
<p>Test out our installation.</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
$memcache = new Memcache;
$memcache-&gt;connect('localhost', 11211) or die ('Can\'t connect!');
$version = $memcache-&gt;getVersion();
echo 'Server version: '.$version;
</pre>
<p>You should see your server&#8217;s version number. If you see a blank page make sure that <a href="http://allurcode.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2FsbHVyY29kZS5jb20vMjAxMC8wMy8xMy9ob3ctdG8taW5zdGFsbC1tZW1jYWNoZWQtb24tY2VudG9zLw==">memcached</a> daemon is working. If you&#8217;re getting &#8220;Can&#8217;t connect!&#8221; message despite running daemon try changing &#8216;localhost&#8217; to &#8217;127.0.0.1&#8242;.</p>
<div class="shr-publisher-156"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href="http://allurcode.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cCUzQSUyRiUyRmFsbHVyY29kZS5jb20lMkYyMDEwJTJGMDMlMkYxMyUyRmhvdy10by1ydW4tbWVtY2FjaGUtaW4tcGhwJTJG" data-shr_title='How+to+run+memcache+in+PHP'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href="http://allurcode.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cCUzQSUyRiUyRmFsbHVyY29kZS5jb20lMkYyMDEwJTJGMDMlMkYxMyUyRmhvdy10by1ydW4tbWVtY2FjaGUtaW4tcGhwJTJG" data-shr_title='How+to+run+memcache+in+PHP'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom Automatic --> <img src="http://allurcode.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=156" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://allurcode.com/2010/03/13/how-to-run-memcache-in-php/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

