Jump to content

Set session path for Memcache


bitmatix
 Share

Recommended Posts

look here:

http://processwire.com/talk/topic/3627-memcache-error-during-installation-process/#entry35527

you have to modify this line to suite your needs :-)

I don't like this solution, because in my case it requires an if/else (because I don't use memcache on my dev machine) which I already have in my config file, to handle db configurations for dev and live system :(

I think it would be better, if it where configurable in config file. 

Link to comment
Share on other sites

Why does it have no effect. I can set it here in config.php.

If I set this:

$config->paths->sessions = 'tcp://localhost:11211';

in my config.php

it get this:

/var/www/tcp://localhost:11211

(debugged with die($config->paths->sessions); in index.php)

Any ideas how to fix this?

Link to comment
Share on other sites

I'm wondering where the '/var/www/' is coming from? I'm guessing that it's being interpreted as a relative directory and expanded. Either way, I think the session.save_path probably needs to stay set to whatever the server default is. FYI, this is what I've updated that line to in /index.php (in my local dev branch) and you may want to make the same change in yours: 

if(ini_get('session.save_handler') == 'files') ini_set('session.save_path', rtrim($config->paths->sessions, '/'));  

Hopefully what will happen there is that the session.save_path call will get skipped entirely, leaving it set to server default (which I'm assuming is tcp://localhost:11211). However, if it isn't, you can perform your own ini_set() call in /site/config.php:

ini_set('session.save_path', 'tcp://localhost:11211');
Link to comment
Share on other sites

Hey Ryan,

thank you for your reply!

I've tried to perform the ini_set() in /site/config.php and left the index.php as it is (no modifications) but it doesn't work. I don't want to modify the index.php because it seems like this file get also updated if I use the "AutoUpgrade" module, and then all my changes made in index.php are gone.

  • Like 1
Link to comment
Share on other sites

I've tried to perform the ini_set() in /site/config.php and left the index.php as it is (no modifications) but it doesn't work. I don't want to modify the index.php because it seems like this file get also updated if I use the "AutoUpgrade" module, and then all my changes made in index.php are gone.

ini_set() in config.php won't work unless you modify the index.php in the manner I mentioned. I think it's okay for you to modify index.php for something like this. Like mentioned earlier, I've already made the same change in the PW source so you'll see it in the 2.3 version soon anyway. Also for safety, be careful with any kind of automatic upgrades on a live server. I tend to only use automatic upgrade tools on dev servers, not production servers. If you've got an instance where you've had to modify the index.php, that would be a good reason not to do automatic upgrades. 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...