PHP is not saving my session data ?

7 June 2004, 10:20 am IST
User Rating: 8.3 (51 votes)

Make sure that you have specified the session.save_path setting in your php.ini file and that it has write permission.

On *nix systems, following is default setting:

session.save_path = "/tmp"

However on windows system, you can set this to you choice of directory.

session.save_path = "D:/temp-sessions"

In case you don't have access to php.ini file, you can use the ini_set() function to set your setting:

<?php ini_set('session.save_path', '/tmp'); ?>

But make sure that PHP has write access on that directory.

P.S.: Generally it is adviced, not to use the default setting of /tmp, as it may have security and privacy implications, as any person, program or script will be able to read the data stored in your sessions files.

Rate this knowledge base item

  • 1

  • 2

  • 3

  • 4

  • 5

  • 6

  • 7

  • 8

  • 9

  • 10
blog comments powered by Disqus



Amit Arora is web developer with expertise in developing eCommerce enabled websites for the businesses.

Contact | Resume

Subscribe to newsletter

Get Firefox

Monitored by Site24x7