<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://sugarclub.sugarcrm.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Set session variables</title><link>https://sugarclub.sugarcrm.com/dev-club/f/questions-answers/543/set-session-variables</link><description>Hi all! I want to set $_SESSION variable in my script what working with rest api of Sugar on one server. But after reload sugar page, i see that $_SESSION i cleanup without my variable. How i can do that?</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Set session variables</title><link>https://sugarclub.sugarcrm.com/thread/17455?ContentTypeID=1</link><pubDate>Fri, 24 Jun 2016 10:56:02 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:a830ba84-290a-4300-826f-2a6927896c6a</guid><dc:creator>Alex Mikhomor</dc:creator><description>&lt;p&gt;oh, guys. Big thanks!&lt;/p&gt;&lt;p&gt;It my fault, what i&amp;#39;m not using &lt;/p&gt;&lt;ol class="dp-c" start="1" style="font-size:12px;font-family:Consolas, &amp;#39;Courier New&amp;#39;, Courier, mono, serif;color:#5c5c5c;"&gt;&lt;li&gt;&lt;span style="font-weight:inherit;font-style:inherit;color:black;"&gt;session_start();&amp;nbsp; &lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;span style="font-weight:inherit;font-style:inherit;color:black;"&gt;All working fine. Big thanks!&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-weight:inherit;font-style:inherit;color:black;"&gt; &lt;/span&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Set session variables</title><link>https://sugarclub.sugarcrm.com/thread/17454?ContentTypeID=1</link><pubDate>Fri, 24 Jun 2016 10:06:48 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:92698374-143d-4ebd-b54b-3b7d53d20edc</guid><dc:creator>Tevfik T&amp;#252;mer</dc:creator><description>&lt;p&gt;Hi &lt;a href="https://sugarclub.sugarcrm.com/members/agriboed"&gt;Alex&lt;/a&gt;,&lt;/p&gt;&lt;p&gt;In your rest api call, are you sure that you are making the settings after starting the session?&lt;/p&gt;&lt;p&gt;I&amp;#39;ve just tried on 7.6.2.1 ENT. (I don&amp;#39;t know your sugar version), using following code i was able to write something to session using rest api then i read/use it from sugar UI.&lt;/p&gt;&lt;pre class="php"&gt;session_start();
$_SESSION['tevfik'] = &amp;#39;OK&amp;#39;;
&lt;/pre&gt;&lt;div style="display:none;"&gt;&lt;/div&gt;&lt;p&gt;You must be missing something.&amp;nbsp; My guess is you forgot to start session. &lt;/p&gt;&lt;p&gt;I hope it helps.&lt;/p&gt;&lt;p&gt;Best Regards&lt;/p&gt;&lt;p&gt;Tevfik T&amp;uuml;mer&lt;/p&gt;&lt;p&gt;Developer Support Engineer&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Set session variables</title><link>https://sugarclub.sugarcrm.com/thread/17453?ContentTypeID=1</link><pubDate>Fri, 24 Jun 2016 09:24:17 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:9391818a-1679-4ae0-86b3-99444d0bc941</guid><dc:creator>Alex Mikhomor</dc:creator><description>&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Thanks, but after refresh page - i dont see my variable. I think, that sugar clean all session_data after every load&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Set session variables</title><link>https://sugarclub.sugarcrm.com/thread/17452?ContentTypeID=1</link><pubDate>Fri, 24 Jun 2016 09:14:15 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:f2c61bca-f6a8-48a1-a5ef-1dda651bd1c5</guid><dc:creator>Mehul  Bhandari</dc:creator><description>&lt;p&gt;Hi &lt;a href="https://sugarclub.sugarcrm.com/members/agriboed"&gt;Alex Mikhomor&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://php.net/manual/en/reserved.variables.session.php" rel="nofollow" target="_blank"&gt;PHP: $_SESSION - Manual&lt;/a&gt; &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>