session variable - help

Hello guys

When I access my site, I start session and set a session variable that I need to use it in other parts of my site, in other pages.

But when I access the new .php I notice that the session variable doesn't has the value.

Shouldn't the session variable belong to all site?  if so, what can it be happening?

thanks
Alex
LVL 1
hidrauAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Ray PaseurConnect With a Mentor Commented:
Here is how the PHP session works:
https://www.experts-exchange.com/articles/11909/PHP-Sessions-Simpler-Than-You-May-Think.html

If you're doing things that way, then your session should preserve stateful information for all pages of your web site.  Try installing and running the session test  script in the article.  If it fails, please post a link here so we can see the failure in action, thanks.
1
 
skullnobrainsConnect With a Mentor Commented:
you need to run session_start() in ALL pages. my guess is you forgot to.

alternatively if the sessions variables do not work at all, you may have misconfigured the session storage location ( for example configuring apache to use memcache while there is no memcache running ) or possibly are using cookie based sessions while cookies are not enabled or not working for some reason
2
 
hidrauAuthor Commented:
Thanks friend.

I'm gonna check this in details and I'll return back to inform where I was doing wrong.
0
 
Ray PaseurCommented:
One other thing to check because it can fail silently... Make sure that PHP has write permissions to write the session.  You can find the file name by running phpinfo() and looking for session.save_path
1
 
hidrauAuthor Commented:
thanks
0
All Courses

From novice to tech pro — start learning today.