Page 1 of 1

Help with memcached and session.save_path please

Posted: Thu Sep 20, 2018 3:17 pm
by Charles Butcher
In the last couple of weeks I've noticed a few persistent problems with the backend. Examples: the "internal page link" button in MicroTiny doesn't work properly, and I can't upload files using the main dialog in the File Manager. As far as I can see, these errors are independent of the user account and the browser.

I'm thinking this may relate to a persistent warning message that appeared recently:

Code: Select all

Warning: session_write_close(): using touch command with binary protocol is not recommended with libmemcached versions below 1.0.18, please use ascii protocol or upgrade libmemcached in /lib/misc.functions.php on line 81
Binary / ASCII? Does that make any sense in this context?

I've checked with my hosting provider and it seems that we have libmemcached 1.0.18 (which appears to be the latest version).

This is CMSms 2.2.8 with PHP 7.1.21. As far as I know, nothing has changed recently in my CMSms setup.

Under System Info > Session Save Path I have "No check because OS path". It's been like that for as long as I can remember, and has worked fine.

In php.ini I have `session.save_handler = memcache` and `session.save_path = "tcp://10.168.1.57:11211?persistent=0&weight=1&timeout=5&retry_interval=15"`.
I tried `session.save_handler = files` and `session.save_path = /tmp/cache` but this seemed to make no difference.

Any suggestions appreciated.

Charles

Re: Help with memcached and session.save_path please

Posted: Thu Sep 20, 2018 5:08 pm
by calguy1000
First. This is not a CMSMS issue. It's related to memcached and php

A quick google determines that this is an issue with php and/or memcached.

I have never played with memcached for session files. but the error message seems to indicate that PHP is not using the latest version of libmemcached. Perhaps something needs to be kicked.

Re: Help with memcached and session.save_path please

Posted: Thu Sep 20, 2018 5:43 pm
by Charles Butcher
Thanks Robert. I contacted my hosting company first because I assumed it was their problem and that libmemcached needed an upgrade.

But what seemed strange is that I turn out to have the latest available version (1.0.18), and according to the warning message this ought to be OK. So I wondered if CMSMS might be involved after all.

I'll ask them to kick something.

Re: Help with memcached and session.save_path please [solved

Posted: Sat Sep 22, 2018 8:53 am
by Charles Butcher
Just to finish this one off: The hosting company changed my session storage from memcache to disk and the problem seems to be solved. No idea why they could not sort out memcache, or what might have changed on the server to cause the problem in the first place, but I'm not going to argue.

Re: Help with memcached and session.save_path please

Posted: Mon Sep 24, 2018 10:42 am
by scooper
Just jumping into this thread with a bit more info because I've spent days trying to sort this out - I suspect with exactly the same hosting company.

First of all this is absolutely not a CMSMS specific issue - it's definitely down to the hosting company.

The issue occurs whenever trying to use memcached to handle sessions under a directory with 'admin' in the name (oh yeah).

So one solution that is CMSMS specific is to rename the admin directory to something non-adminy and update the config settings with the new directory name:

Code: Select all

$config['admin_dir']='hatstand';
another is, as mentioned, to switch session handling to files instead of memcached, and another is of course to switch to a hosting provider who just doesn't do this kind of thing.

Re: Help with memcached and session.save_path please

Posted: Mon Sep 24, 2018 1:14 pm
by Charles Butcher
Thanks scooper – that's really interesting. I'll PM you about the hosting company, since I'm probably too far off-topic already!

I used to use a different name for the admin directory, after reading somewhere that it might help stop people snooping around. But when I upgraded to CMSMS v2 I just went with the default.

I have to say that session storage on disk seems to be working fine. This is cheap hosting, and the site is often slow, especially on the backend. But at the moment it's looking good.

Re: Help with memcached and session.save_path please

Posted: Thu Nov 29, 2018 6:39 pm
by JamesT
I have the same issue and I know which company you are talking about. To be honest, I think you are along the right lines when you mentioned changing hosts, and not only because of this.

Re: Help with memcached and session.save_path please

Posted: Thu Nov 29, 2018 9:33 pm
by Charles Butcher
Recommendations for good UK-focused hosting companies always welcome, but I'm on a low (i.e. spare time non-profit) budget and I do really like my existing provider, tso I do. Apart from this one craziness.

Re: Help with memcached and session.save_path please

Posted: Thu Nov 29, 2018 9:41 pm
by JamesT
Fair enough, I admit personally I've had other sub-optimal experiences with them.

I've had good experience with a small UK provider, I'll PM it.

Incidentally I found another fix to the issue, set:

Code: Select all

memcached.sess_binary_protocol = 0
in

Code: Select all

public_html/.user.ini
This will set memcached to the ascii protocol like the error message suggests.

Re: Help with memcached and session.save_path please

Posted: Thu Nov 29, 2018 9:58 pm
by Charles Butcher
Thank you James. I would never have discovered that by myself, but it looks so simple I'm surprised it was beyond the hosting company didn't do it that way. Good tip.