How can I preserve sessions when I deploy to Heroku? How can I preserve sessions when I deploy to Heroku? heroku heroku

How can I preserve sessions when I deploy to Heroku?


Another option not mentioned is to use Memcached to store sessions. You can use the heroku addon Memcachier (https://addons.heroku.com/memcachier).

To configure php to use the memcached session handler, take a look at the extension's manual at http://php.net/manual/en/memcached.sessions.php. Basically you set the php.ini directives:

session.save_handler = memcachedsession.save_path = "localhost:11211"

Replace the save_path with the Memcachier address and port you are given when installing the add-on.


You will need to store your sessions in a database. You can store them in Postgres, or something like Redis. These will be persisted during deployments.


I use AppFog, Memcachier now supports SASL, but I do not know how to continue.

session.save_handler = memcached
session.save_path = "localhost: 11211"

What is missing now is the authentication and I do not know how to put itI found this but I do not know if it will work and how to use
http://php.net/manual/en/memcached.setsaslauthdata.php
pd: I dont have access in appfog to php.ini so I need do this via htaccess, can you give me an example how to do this in htaccess ?
https://docs.appfog.com/languages/php#php_ini
Thanks