Recommend this page to a friend! |
Classes of Gjero Krsteski | PIMF | manuscript/8a. Session configuration.md | Download |
|
DownloadSession configurationThe session data for each visitor is stored on your web server, while a cookie containing a session ID is stored on the visitor's machine. This cookie allows your application to remember the session for that user and retrieve their session data on subsequent requests to your application. Following session storages are available out of the box:
Before using sessions, make sure an application key has been specified in the config.app.php file.
Cookie StorageCookie based sessions provide a light-weight and fast mechanism for storing session information. They are also secure. Each cookie is encrypted using strong AES-256 encryption. However, cookies have a four kilobyte storage limit, so you may wish to use another storage if you are storing a lot of data in the session. To get started using cookie sessions, just set the storage option in the config.app.php file. File System StorageIf your application will work great using file system sessions. However, if your application receives heavy traffic or runs on a server farm, use database or Memcached sessions. To get started using file system sessions, just set the storage option in the config.app.php file. File system sessions are stored in the 'app/YourAppName/_session/' directory, so make sure it's writeable. Database StorageTo start using database sessions, you will first need to configure your database connection. Next, you will need to create a session table. However, you may also use PIMF's command-line to generate the table for you!
Memcached StorageBefore using Memcached sessions, you must configure your Memcached servers. Just set the storage in the config.app.php file. Redis StorageBefore using Redis sessions, you must configure your Redis servers. Just set the storage in the config.app.php file. DBA StorageThe DBA is ultra-fast session storage that uses the database (dbm-style) abstraction layer to cache/store your PHP objects, strings, integers or arrays. You don`t have to matter about the size of the cache-file. It depends on the free space of your disk. You have to compile your PHP –enable-dba=shared and –with-[qdbm|flatfile|db4] before using it. In-Memory StorageThe memory session storage just uses a simple array to store your session data for the current request. This storage is perfect for unit testing your application since nothing is written to disk. It shouldn't ever be used as a real session storage. |