Link to home
Avatar of edyonline

asked on

[urgent] php session suddenly doesn't work

All of the sudden all of my session doesn't work properly. I even copy and paste the sample on the following page:

when i go to next page, the session variable are empty. print_r($_SESSION) displays nothing. Help me!

Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Is session_start() at the top of every page?
Avatar of edyonline


yes, nothing changed, is this server side issue?
Was there any change / update at the web host ?
PHP upgrade ? Do you use cookies with sessions ?
It has to be because the only thing browsers have to do with the session is possibly storing a cookie with the session id.  And yes, Something has changed or it would be working still.  Make sure there is nothing, not even white space, before the first "<?php" tag.
1. What does your code look like?

2. What happens when you:
echo session_id();
...after session_start()?

3. Have you tried the full steps to reproduce the problem on different browsers or on different networks?

4. If it happens with all browser / all networks, then the problem is definitely on the server, in which case I would first check for any disk space issues, then I would look at my php.ini file to find out where the session files are stored and would double-check to make sure there are no permissions problems there (a file should be created for each new session).
it's not resolved yet but i think i'm getting close to find the root cause.. everytime I reboot the server, the session works just fine... but after a while the session problem come  back again... maybe something to do with memory or space issue?
to add more information, I checked the  save_path in php.ini and all files inside that folders have 0 bytes  file. But as i said previously, after reboot immediately everything is good for a while. How do I fix it? what should I look next?
It's resolved now. The problem was the space issue. 100% on the mounted hd. Freed up some huge files and everything works perfect
I suggested checking for disk space issues.
Avatar of gr8gonzo
Flag of United States of America image

Blurred text
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
sorry i didn't really read your suggestion carefully because i was in panic mode yesterday. Had I read your suggestion first, I didn't have to go through it my self