<?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>Solid State Raam &#187; PHP</title>
	<atom:link href="http://solidstateraam.com/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://solidstateraam.com</link>
	<description>Explorations (and exploitations) of the digital world by one of its many netizens.</description>
	<lastBuildDate>Sat, 17 Dec 2011 20:18:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Including Custom Post Type in Default WordPress RSS Feed</title>
		<link>http://solidstateraam.com/including-custom-post-type-in-default-wordpress-rss-feed/</link>
		<comments>http://solidstateraam.com/including-custom-post-type-in-default-wordpress-rss-feed/#comments</comments>
		<pubDate>Sat, 17 Dec 2011 20:18:47 +0000</pubDate>
		<dc:creator>Raam</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://solidstateraam.com/?p=665</guid>
		<description><![CDATA[To control what post types show up in the default WordPress RSS feed, you can add a function to your themes functions.php file (if one doesn&#8217;t exist, create it in your theme folder) to control what is returned when the RSS feed is requested. If we wanted to modify this so that the default feed [...]]]></description>
			<content:encoded><![CDATA[<p>To control what post types show up in the default WordPress RSS feed, you can add a function to your themes <code>functions.php</code> file (if one doesn&#8217;t exist, create it in your theme folder) to control what is returned when the RSS feed is requested.</p>
<pre class="brush: php; title: ; notranslate">
function myfeed_request($qv) {
	// If a request for the RSS feed is made, but the request
	// isn't specifically for a Custom Post Type feed
	if (isset($qv['feed']) &amp;&amp; !isset($qv['post_type'])) {
		// Return a feed with posts of post type 'post'
		$qv['post_type'] = array('post');
	}

	return $qv;
}
add_filter('request', 'myfeed_request');
</pre>
<p>If we wanted to modify this so that the default feed includes <code>'post'</code> and a entries from <a href="http://codex.wordpress.org/Post_Types#Custom_Types">Custom Post Type</a> <code>'thoughts'</code>, we can modify the function as follows:</p>
<pre class="brush: php; title: ; notranslate">
function myfeed_request($qv) {
	// If a request for the RSS feed is made, but the request
	// isn't specifically for a Custom Post Type feed
	if (isset($qv['feed']) &amp;&amp; !isset($qv['post_type'])) {
		// Return a feed with posts of post type 'post' and 'thoughts'
		$qv['post_type'] = array('post', 'thoughts');
	}

	return $qv;
}
add_filter('request', 'myfeed_request');
</pre>
]]></content:encoded>
			<wfw:commentRss>http://solidstateraam.com/including-custom-post-type-in-default-wordpress-rss-feed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Session Permission Denied Errors with Sub-Domains and IE7 or IE8</title>
		<link>http://solidstateraam.com/php-session-permission-denied-errors-with-sub-domains-and-ie7-or-ie8/</link>
		<comments>http://solidstateraam.com/php-session-permission-denied-errors-with-sub-domains-and-ie7-or-ie8/#comments</comments>
		<pubDate>Tue, 05 Jan 2010 13:23:42 +0000</pubDate>
		<dc:creator>Raam</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Internet Explorer]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Weird]]></category>

		<guid isPermaLink="false">http://solidstateraam.com/?p=493</guid>
		<description><![CDATA[I encountered a strange problem with IE7 and IE8 where if I visited example.com first and then visited sub-domain.example.com, Apache would return Permission Denied errors errors when trying to access the PHP session files for sub-domain.example.com. After some investigation, it appears this is a problem with the way IE7 and IE8 request session data from Apache, or possibly because IE7 and IE8 have a non-standard way of announcing the domain they're requesting session data for.]]></description>
			<content:encoded><![CDATA[<p>I encountered a strange problem with IE7 and IE8 where if I visited example.com first and then visited sub-domain.example.com, Apache would return Permission Denied errors errors when trying to access the PHP session files for sub-domain.example.com.</p>
<p>After some investigation, it appears this is a problem with the way IE7 and IE8 request session data from Apache, or possibly because IE7 and IE8 have a non-standard way of announcing the domain they&#8217;re requesting session data for.</p>
<p>Here&#8217;s my scenario:</p>
<p>I&#8217;m running Apache 1.3 with two domains, each has their own account with their own users:</p>
<pre class="brush: plain; title: ; notranslate">
    Domain: mycompany.com
    Session path: /tmp/
    Webserver user: mycompanycom

    Domain: support.mycompany.com
    Session path: /tmp/
    Webserver user: nobody
</pre>
<p>Here is what happens during a normal visit with Firefox/Safari/Chrome:</p>
<ol>
<li>I visit mycompany.com and session file is created in <code>/tmp/</code> owned by the user <code>mycompanycom</code></li>
<li>I then visit support.mycompany.com, and second session file is created in <code>/tmp/</code> owned by user <code>nobody</code></li>
<li>Apache doesn&#8217;t get confused and the correct session files are returned</li>
</ol>
<p>However, here&#8217;s what happens during a visit with IE7 and IE8:</p>
<ol>
<li>I visit mycompany.com and a session file is created in <code>/tmp/</code> owned by the user <code>mycompanycom</code></li>
<li>I then visit support.mycompany.com and, instead of creating second session file in <code>/tmp/</code> owned by the user <code>nobody</code> as you would expect (and as happens when using Firefox/Safari/Chrome), Apache tries to return the session file for mycompany.com. </li>
<li>The session file for mycompany.com is owned by the user <code>mycompanycom</code>, so the web server, running as user <code>nobody</code> cannot access it. Permission is denied.</li>
</ol>
<p>I searched Google for a solution and came across <a href="http://stackoverflow.com/questions/912098/permissions-to-php-session-files/">this question on StackOverflow</a>. Several users suggested creating a separate directory in <code>/tmp/</code> to separate the stored session data for support.mycompany.com from the session data for mycompany.com and then telling PHP to store all session data for support.mycompany.com in the new directory. This worked perfectly!</p>
<p>Here&#8217;s what I did. First, create the new session directory (Note: Make sure the new directory resides inside <code>/tmp/</code>!):</p>
<pre class="brush: bash; title: ; notranslate">
    mkdir /tmp/support.mycompany.com
    chown nobody:nobody /tmp/support.mycompany.com
</pre>
<p>I then added the following to an <code>.htaccess</code> file in the root web directory for support.mycompany.com:</p>
<pre class="brush: bash; title: ; notranslate">
    php_value session.save_path '/tmp/support.mycompany.com'
</pre>
<p>And finally, I removed all existing session data in <code>/tmp/</code> to ensure the new session path would get used immediately:</p>
<pre class="brush: bash; title: ; notranslate">
    rm -f /tmp/sess_*
</pre>
<p>And that&#8217;s it! Now IE7 and IE8 work properly because when visiting support.mycompany.com, IE7 and IE8 do not accidentally find session data for mycompany.com and try to use it.</p>
<p>I&#8217;m fairly certain this problem has to do with how IE7 and IE8 request session data from Apache. They probably first request session data for mycompany.com and THEN request session data for support.mycompany.com, even though the latter was the only doman entered in the address bar.</p>
]]></content:encoded>
			<wfw:commentRss>http://solidstateraam.com/php-session-permission-denied-errors-with-sub-domains-and-ie7-or-ie8/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

