0

Where are the sessions stored on apache server? File system or in memory?

e.g if I am writing a php script and store some data in the session variable and on the next page if I read this session data, where have I read this session data from?

Obaid Maroof
  • 1,523
  • 2
  • 19
  • 40

1 Answers1

0

Did you have a look at phpinfo() ?

For example, we see:

session
Session Support     enabled
Registered save handlers    files user
Registered serializer handlers  php php_binary wddx

Directive   Local Value Master Value
session.auto_start  Off Off
session.bug_compat_42   Off Off
session.bug_compat_warn On  On
session.cache_expire    180 180
session.cache_limiter   nocache nocache
session.cookie_domain   no value    no value
session.cookie_httponly Off Off
session.cookie_lifetime 0   0
session.cookie_path /   /
session.cookie_secure   Off Off
session.entropy_file    no value    no value
session.entropy_length  0   0
session.gc_divisor  1000    1000
session.gc_maxlifetime  1440    1440
session.gc_probability  1   1
session.hash_bits_per_character 5   5
session.hash_function   0   0
session.name    PHPSESSID   PHPSESSID
session.referer_check   no value    no value
session.save_handler    files   files
session.save_path   /var/lib/php/session    /var/lib/php/session
session.serialize_handler   php php
session.use_cookies On  On
session.use_only_cookies    Off Off
session.use_trans_sid   0   0

You should be able to leverage: PHPSESSID

Leptonator
  • 3,379
  • 2
  • 38
  • 51
  • According to this configuration, its stored in a file. Right? Wouldn't it be better if it exists somewhere in the memory for faster retrieval? – Obaid Maroof Dec 05 '13 at 09:39
  • 1
    Discussed (among other places) here: http://stackoverflow.com/questions/13946033/is-it-recommended-to-store-php-sessions-in-memcache – Eike Pierstorff Dec 05 '13 at 09:42