tags:

views:

39

answers:

2

Hello. I have some (crappy) software that nevertheless works on all the installs I've done except this new one. The problem seems to be that session variables are not being set, or that every time session_start is getting called it destroys the old session, even though I am using cookies. Looking at php.net's info on sessions, I came across a session tester.

Well, I uploaded the session tester to my site to see what was going on, and it looks like something is misconfigured with the server, but I want to be sure of what is going wrong before I call into tech support.

So my question is, since 'foo' can't be set, it means there is something not configured properly with the server?

Here is phpinfo if it would help.

Thanks.

+1  A: 

Some ideas:

  1. Make sure sessions can be written to the save_path (/var/php_sessions, in your case), and read by the Apache user
  2. Are there Apache configs modifying something?
  3. Try var_dump($_SESSION);
  4. Try inspecting the session file (typically "sess_XXXXX" in the save_path)
  5. Increase the error logging and check any error logs
  6. Try using non-cookie sessions
  7. Try using a different session saving method (custom or sqlite)
  8. Is it a shared host? If so, do sessions work for other people?
Richard Levasseur
It is a shared host, ipowerweb.com, cheapo plan. I've looked around the ftp, and I can't find a var directory anywhere, at /, inside public_html, or inside the subdirectory to which the host points requests from the dns. I'm beginning to think that there are no session values being saved because there is nowhere to same them. Unless the /var/ is occuring somewhere below the directory which the server is setting as root for my account (a possibility since there are probably thousands of sites hosted on the computer)
Joseph Carrington
3: var_dump($_SESSION) prints the session variables, until the session_start() is called during the next request.4. Can't find it, see above.Working on 5
Joseph Carrington
"var_dump($_SESSION) prints the session variables, until the session_start()" it should print `NULL` until `session_start` is called. If its printing something before `session_start` is called then you are starting the session twice.
Salman A
A: 

Ask your hosting provider company to look into this matter. I suspect there is a problem with session related settings, session.save_path in particular.

EDIT ----

Try setting your error reporting to full and see if PHP complains about something. Add these two lines to the very beginning of your scripts:

ini_set( "display_errors", 1 );
ini_set( "error_reporting", E_ALL );
Salman A
session.php updated. Looks like I can send this to tech support. Hooray!
Joseph Carrington