<?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>devtrends.com &#187; PHP</title>
	<atom:link href="http://www.devtrends.com/index.php/category/software-development/web-development/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.devtrends.com</link>
	<description>developing trends in information technology</description>
	<lastBuildDate>Tue, 06 Sep 2011 19:27:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>PHP Sessions Not Working</title>
		<link>http://www.devtrends.com/index.php/php-sessions-not-working/</link>
		<comments>http://www.devtrends.com/index.php/php-sessions-not-working/#comments</comments>
		<pubDate>Mon, 05 Oct 2009 03:58:22 +0000</pubDate>
		<dc:creator>aaron</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[php.ini]]></category>
		<category><![CDATA[sessions]]></category>
		<category><![CDATA[Temp]]></category>

		<guid isPermaLink="false">http://www.devtrends.com/?p=277</guid>
		<description><![CDATA[As a jack of all trades, I was doing some development work in PHP on one of my internal servers. As with most web sites, I needed to use sessions...]]></description>
			<content:encoded><![CDATA[<p>As a jack of all trades, I was doing some development work in PHP on one of my internal servers. As with most web sites, I needed to use sessions variables in the PHP script. However, when I attempted to create the session variable through code similar to below, the session variables were empty when I tried to work with them in the same page or another page.</p>
<pre style="padding-left: 30px;">&lt;?php
  session_start();
  $_SESSION['user'] = "aaron";
  echo $_SESSION['user'];
?&gt;</pre>
<p>I searched the web for an answer and got the standard realm of how to resolve PHP sessions issues, such as ensuring &#8220;session_start()&#8221; is used BEFORE any HTML output is produced &#8211; none of the solutions worked. After thinking about the process involved with a session object, I started to wonder where the PHP process kept the sessions on the server. Some research on the Internet pointed to a temp folder, and on Linux with Apache this would probably be the /tmp directory. Unfortunately, my server is a Windows Server with IIS.</p>
<p>So, as one might imagine, the configuration of temp file location is kept in the php.ini file &#8211; which by the way, must reside in the C:\[WINDOWS FOLDER]\ and all changes require an IIS restart.</p>
<p>There are two steps to repair: (a) analyze and modify the php.ini file; and (b) modify the permissions on the folder as configured in the php.ini.</p>
<p style="padding-left: 30px;">(a): In the php.ini file, locate the following configuration lines and replace with a folder of your choosing. In my situation the original location was the temp folder of the Administrator profile. Because I do not want to modify the permissions for that folder, I decided to create C:\Temp\php\session\ and C:\Temp\php\upload\. My php.ini configuration is similar to the following:</p>
<pre style="padding-left: 60px;">upload_tmp_dir="C:\Temp\php\upload"
session.save_path="C:\Temp\php\session"</pre>
<p style="padding-left: 30px;">(b): Create the new temp location as configured in the php.ini file. Modify the permissions and add IUSR_[name] with Write/Read/Execute. Although I would highly discourage you from doing so, in my case, since this is a test box I gave EVERYONE permission to the temp folder.</p>
<p>Restart IIS using the Services MMC or through the command prompt iisreset tool. PHP sessions should now work.</p>
<p>-Aaron Gilbert</p>
]]></content:encoded>
			<wfw:commentRss>http://www.devtrends.com/index.php/php-sessions-not-working/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

