I have Craft installed on Heroku using Memcached for sessions. Craft is kicking me out of the admin area every minute or two. It's deriving me crazy. I've also set the user session duration in general.php:
'userSessionDuration' => 'P2W'
Still kicking me out.
If I set it to dev mode, I get this error:
Undefined variable: _SESSION
I know that the session does work, because I can login. I can also check the currentUser variable and see people signed in. The thing is, it isn't lasting long and makes the admin area nearly unusable.
My composer file is really simple. Nothing complicated.
{
"require": {
"ext-mbstring": "*",
"ext-imagick": "*"
},
"require-production": {
"ext-memcached": "*"
}
}
EDIT:
Also, here are my Memcached settings in the /public/.user.ini file (as recommended by Heroku):
session.save_handler=memcached
memcached.sess_binary=1
session.save_path="PERSISTENT=myapp_session ${MEMCACHIER_SERVERS}"
memcached.sess_sasl_username=${MEMCACHIER_USERNAME}
memcached.sess_sasl_password=${MEMCACHIER_PASSWORD}
SOLUTION:
For anyone interested, the Memcached extension in my composer.json file wasn't being picked up by Heroku on deploy. So I updated my composer.json file like this:
{
"require": {
"ext-mbstring": "*",
"ext-imagick": "*",
"ext-memcached": "*"
}
}
Then ran composer update
to update the composer.lock file.
When deploying to Heroku, the composer.lock file is very similar to the Gemfile.lock in Rails - telling Heroku exactly what to install with the deployment. Now the Memcached extension is being installed by Heroku and my session problem has been solved.