Board index   FAQ   Search  
Register  Login
Board index PHP PHP General

session data not saving

General discussions related to php

Moderators: macek, egami, gesf

session data not saving

Postby kyle04 » Sat Jul 07, 2012 2:04 pm

Since my site was transfered to a new server by my hosting company, my $_SESSION data is not being saved.

I have set the variables via my php.ini file as instructed, although never had to do this before, (eg session.save_path = /home/user/tmp).
The session files are being created in the correct folder, but are always empty.

On running test scripts:

current page $_SESSION variables return correct data array (as you would expect...)
sesson_decode() returns nothing
session file path is writable returns true
session files perms = 600
php version : 5.2.17
server : Linux


full php ini settings so far :

session.save_path = /home/user/tmp
session.use_cookies = 1
session.name = PHPSESSID
session.serialize_handler = php
session.gc_probability = 1
session.gc_divisor = 100
session.gc_maxlifetime = 1440
session.bug_compat_42 = 1
session.bug_compat_warn = 1
session.entropy_length = 0
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 0
session.save_handler = files

I've had to reprograme my shopping cart scripts to manually write "session" data to another directory so thay can function and my company dosen't go bust !
Hosting company no help at all...

Anything I might have missed ??
kyle04
New php-forum User
New php-forum User
 
Posts: 94
Joined: Sat Jul 07, 2012 1:36 pm

Re: session data not saving

Postby johnj » Sun Jul 08, 2012 5:11 am

Is writable returns true does not mean that the concerned folder exists.make sure that the session file path exists.
johnj
php-forum Super User
php-forum Super User
 
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm

Re: session data not saving

Postby kyle04 » Mon Jul 09, 2012 4:15 pm

The save_path is correct - session files are being generated (sess_............), but not being written to.

The generated files can be written to using fwrite .
kyle04
New php-forum User
New php-forum User
 
Posts: 94
Joined: Sat Jul 07, 2012 1:36 pm

Re: session data not saving

Postby johnj » Mon Jul 09, 2012 7:25 pm

How do you justify that the session path is correct?. Is it write protected? Fix this issue first.
johnj
php-forum Super User
php-forum Super User
 
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm

Re: session data not saving

Postby kyle04 » Tue Jul 10, 2012 2:27 am

Only that :
1) The session files are being created in the specified folder on a session initiating - the permissions for each file are 600
2) Perms for the folder itself are 755
3) I can use fwrite to write test data to a selected session file, but calling $_SESSION variables or even using session_register() caused no data to be written to the file.

Thanks
AndyP
kyle04
New php-forum User
New php-forum User
 
Posts: 94
Joined: Sat Jul 07, 2012 1:36 pm

Re: session data not saving

Postby johnj » Tue Jul 10, 2012 9:01 pm

use ini_set(' session.save_path','SOME PATH'); in one of your files and see if it is able to write to another path.
johnj
php-forum Super User
php-forum Super User
 
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm

Re: session data not saving

Postby johnj » Tue Jul 10, 2012 9:06 pm

Also - use ini_set ( 'display_errors', 'On' ); in of your pages and see if there is some other error which is causing this.
johnj
php-forum Super User
php-forum Super User
 
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm

Re: session data not saving

Postby johnj » Tue Jul 10, 2012 9:14 pm

On your new server - what is the operating system they are using?. What webserver are they using?
johnj
php-forum Super User
php-forum Super User
 
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm


Return to PHP General

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.