PHP memcache warning error - php

Basically i am trying to read the FTP files from serve via cron job.
I am getting following error
Warning: Unknown: Failed to write session data (memcache). Please
verify that the current setting of session.save_path is correct
(tcp://...:11211?persistent=1&weight=1&timeout=1&retry_interval=15)
in Unknown on line 0
I don't have idea why i am getting this error. Any idea what is missing there
Thanks

I'd recommend updating your php.ini to use file based caching unless memcache is what you need.
Change session.save_handler to files.
http://php.net/manual/en/session.configuration.php
Memcache is typically used when you have multiple servers that need to share the same session (a.k.a behind a load balancer)

Related

PHP 8 on IIS 2019: Sometimes Session can not be written

From time to time I get the classic "Failed to read session data" error on my application running on php 8, IIS 2019. This is usually associated with a) the directory does not exist b) the permissions are not set. I can rule out both cases.
Sessions are stored in c:/Temp/phpsessions. All read/write permissions are set correctly. Most of the times there is no problem. But if users doesn't log in for a while I get the following warning and the app does not work.
PHP Warning: session_start():open(C:\temp\phpsessions\sess_221kd8pv25fvefq#tnph9fhoss,O_RDWR)failed:Permission denied(13)...
Again, the session_path is set in php.ini, most of the time everything works. I thought maybe the session key does not have a corresponding session file anymore. But that should not generate an error but a new session. What am I missing?
I tried to store Session Variables and start the session with session_start(). I expect an old session to be invalid and not cause a permission denied warning. I expect a new empty session to be created.
The "Failed to read session data" error can occur for a number of reasons, it may be caused by a misconfiguration of the PHP process. Check the session_handler parameter in the PHP process handler. For more information, please refer this document. Hope this idea helps you.

cakephp 3 [RuntimeException] Unable to configure the session, setting session.cookie_path failed

I try to transfer a cakephp3 application from my local server to a webspace.
I get the following error-message:
[RuntimeException] Unable to configure the session, setting session.cookie_path failed
What does this mean and how can I fix it?
http://marcusmoenius.lima-city.de/app/users/login
So I applied a workaround:
following the stacktrace I opened the file
/app/vendor/cakephp/cakephp/src/Network/Session.php(212): Cake\Network\Session->options(Array)
and scrolled to line 212
there I changed
if (!empty($config['ini']) && is_array($config['ini'])) {
$this->options($config['ini']);
}
to
if (!empty($config['ini']) && is_array($config['ini'])) {
//$this->options($config['ini']);
}
My website loads now and I can login and logout
Cake is using ini_set to modify that setting as far as i know.
Either the webhoster providing your webspace prohibits setting cookie_path or prohibits using ini_set completly.
Btw: http://marcusmoenius.lima-city.de/ shows output of phpinfo from your server. Thats a security risk, you should disable it.
Edit: Using google may have solved you problem faster: CakePHP Error: Unable to configure the session, setting session.auto_start failed

Failed to write session data (memcache)

I'm noticing an intermittent issue with our Memcached session handler. The error that occurs is:
Unknown: Failed to write session data (memcache). Please verify that
the current setting of session.save_path is correct.
Notes:
It seems to be an intermittent issue that occurs 5 or 6 times a day to various users.
Memcached is not localhost. i.e. It's on a different server than the web server.
I'm using the Memcache extension (as opposed to the MemcacheD extension).
I'm using the tcp prefix. If you look at this question, you'll see that the "fix" was to put tcp:// a prefix if you're using the Memcache extension.
My php.ini settings:
session.save_handler = memcache
session.save_path = "tcp://64.233.191.255:11211"
Note that I've also used:
session.save_path = "tcp://64.233.191.255:11211?persistent=1&weight=1&timeout=1&retry_interval=15"
But it doesn't seem to matter.
Checked the memcached.log file, where I found the following error:
Failed to write, and not due to blocking: Connection reset by peer.
Note: This particular error occurs at least once, at the same time (01:07AM), everyday. It will then occur sporadically throughout the day.
Maybe you're running out of filehandles? Perhaps the backups make your machine swap, resulting in slower responses, meaning more concurrent connections to the memcached process resulting in a stampeding hurd.

Failed to write session data, php and memcached

I have recently tried implementing memcached for session saving in php.
I modified the session.save_handler in my php.ini and for the most part it works correctly. Sessions are saved in it. However, once in a while, I get this weird message for certain sessions:
PHP Warning: Unknown: Failed to write session data (memcached). Please verify that the current setting of session.save_path is correct (x.x.x.x:11211) in Unknown on line 0.
The session data is the same, way under the 1MB barrier of memcached and I have yet to see a pattern in the occurences of this message... maybe a couple of times every minute. The website is usually under medium load, 150 users concurrently.
If you are using memcache then save_path must have the tcp:// prefix.
If you are using memcached then the save_path should not have the tcp:// prefix.
The answer is Memcached objects can be maximum of 1MB (default)
if your array or object exceeds this limit, the object will be removed magically :)
All the items in your session will be removed, just saying this because right now at this moment I have experienced it my self
I solved it by starting the Memcached Session server like this
memcached -I 10m
I believe it is something to do with using the memcached extension and it not initializing before the sessions. I switched to using the memcache extension rather than the memcached extension and it works.
session.save_handler = memcache
session.save_path="tcp://192.168.1.103:11211"
I had a similar issue with symfony2 and memcached on a docker-compose stack.
The error stated:
Warning: Failed to write session data (user). Please verify that the current setting of session.save_path is correct
And the problem was that I had an outdated ./app/config/parameters.yml
Check your memchached setting to fit your needs, e.g.:
parameters:
session_memcached.host: '%session_memcached_host%'
session_memcached.port: '%session_memcached_port%'
session_memcached.prefix: '%session_memcached_prefix%'
session_memcached.expire: '%session_memcached_expire%'

WP E Commerce Safe Mode restriction error

I have my online shop, created with WP Ecommerce getting broken after I moved it to another server. I could be sure that the problem comes from WP Ecommerce because when I disable that plugin. Everything run as expected. This is the exact error message
Warning: session_start() [function.session-start]: SAFE MODE Restriction in effect. The script whose uid is 515 is not allowed to access /tmp owned by uid 0 in /home/mikalu/public_html/wp-content/plugins/wp-e-commerce/wpsc-core/wpsc-constants.php on line 17
Fatal error: session_start() [<a href='function.session-start'>function.session-start</a>]: Failed to initialize storage module: files (path: ) in /home/mikalu/public_html/wp-content/plugins/wp-e-commerce/wpsc-core/wpsc-constants.php on line 17
I've tried to turn off safe mode on my php configuration. nothing happens. the error's still there.
I thought it was some kind of permission issue, so I tried to change /tmp permission to 777. Nothing happens. I googled it some more and suspect it might have something to do with fastCGI configuration and stuff. Which I totally don't understand.
My googling result mostly suggest me to consult the web hosting provider or even to move to another host. But in this case, I am the owner of the server (VPS with cPanel/WHM). And I don't have any idea how to solve this kind of problem
Any help would be very much appreciated :)
edit: I'm not so sure of this is really a server issue. Because if it really server configuration issue on session save path. Then the whole wordpress shouldn't be working coz it obviously use some session too. The session problem only come from that particular wp-ecommerce script. That's why I post it here on stackoverflow too.
After your edit, it's more clear why you ask that question. Wordpress itself does not uses PHP session, so it's not causing the issue but those component you're using is using PHP sessions.
The PHP manual normally is a good start to understand safemode and how to disable it: http://php.net/manual/features.safe-mode.php
Additionally you should review your server configuration that it is safe instead. Safe-mode is unsafe. Hopefully your server ain't.

Categories