<?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>Marco Pracucci &#187; Zend Framework</title>
	<atom:link href="http://blog.pracucci.com/category/programming/php/zend-framework-php-programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.pracucci.com</link>
	<description>Marco Pracucci - Technology news and blog</description>
	<lastBuildDate>Thu, 25 Feb 2010 12:39:35 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Zend Framework and Session Cookies across Subdomains</title>
		<link>http://blog.pracucci.com/2008/09/24/zend-framework-and-session-cookies-across-subdomains/</link>
		<comments>http://blog.pracucci.com/2008/09/24/zend-framework-and-session-cookies-across-subdomains/#comments</comments>
		<pubDate>Wed, 24 Sep 2008 17:00:06 +0000</pubDate>
		<dc:creator>Marco Pracucci</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[cookie]]></category>
		<category><![CDATA[session]]></category>
		<category><![CDATA[subdomain]]></category>
		<category><![CDATA[zend framework]]></category>

		<guid isPermaLink="false">http://blog.pracucci.com/2008/09/24/zend-framework-and-session-cookies-across-subdomains/</guid>
		<description><![CDATA[Session support in PHP consists of a way to preserve certain data    across subsequent accesses. Each visitor accessing the web site is assigned a unique id, the    session id. This session id is either stored in a cookie or propagated in the url. The best solution is to store [...]]]></description>
			<content:encoded><![CDATA[<p>Session support in PHP consists of a way to preserve certain data    across subsequent accesses. Each visitor accessing the web site is assigned a unique id, the    <strong>session id</strong>. This session id is either stored in a <strong>cookie</strong> or propagated in the url. The best solution is to store it in a cookie.</p>
<p>The cookie used to store the session id sets, by default, the cookie domain to the current domain. This means that if you are visiting www.domain.com, the session id will be stored in a cookie bounded to the domain www.domain.com. This behavior leads to a problem: if your site uses multiple subdomains, the session won&#8217;t be shared between the site&#8217;s subdomains.</p>
<p>To solve this problem you have to share the cookie between all subdomains, setting its domain it to &#8220;.domain.com&#8221;. The following code shows how to change the session cookie domain with <strong>Zend Framework</strong>:</p>
<pre class="prettyprint">
Zend_Session::start(array('cookie_domain' =&gt; '.domain.com'));</pre>
<h3>Browers compatibility</h3>
<p>The prefix dot in &#8220;.domain.com&#8221; is not always necessary, but it&#8217;s <strong>highly recommended</strong> to support all browsers.</p>
<h3>References</h3>
<ul>
<li><a href="http://www.jontodd.com/2006/08/10/php-session-cookie-multiple-domains/" title="PHP session cookie multiple domains" target="_blank">PHP session cookie multiple domains</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.pracucci.com/2008/09/24/zend-framework-and-session-cookies-across-subdomains/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
