PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, November 13, 2022

[FIXED] Why PHP Sessions Memcached works but Memcache doesn't?

 November 13, 2022     centos, magento, memcached, php     No comments   

Issue

I'm trying to figure out what's wrong for hours,

<?php
ini_set("session.save_handler","memcached");
ini_set("session.save_path","127.0.0.1:11211");

session_start();
print "Session started..\n<br />\n";
?>

Will print but if it's "memcache" notice the "d" it will not work + fire the error in php-fpm

php -i | grep memcach

memcache
memcache support => enabled
memcache.allow_failover => 1 => 1
memcache.chunk_size => 32768 => 32768
memcache.compress_threshold => 20000 => 20000
memcache.default_port => 11211 => 11211
memcache.hash_function => crc32 => crc32
memcache.hash_strategy => consistent => consistent
memcache.lock_timeout => 15 => 15
memcache.max_failover_attempts => 20 => 20
memcache.protocol => ascii => ascii
memcache.redundancy => 1 => 1
memcache.session_redundancy => 2 => 2
Registered save handlers => files user memcache redis

php.ini set as following:

session.save_path = "/var/lib/php/session"
session.save_handler = files

error in php-fpm

 PHP Fatal error:  session_start(): Failed to initialize storage module: memcache (path: /var/lib/php/session) in /home/webs/pricegoto.com/app/code/core/Mage/Core/Model/Session/Abstract/Varien.php on line 125

Solution

Try some thing like this :

ini_set('session.save_handler', 'memcache');
ini_set('session.save_path',
'tcp://localhost:11211?persistent=1&amp;weight=1&amp;timeout=1&amp;retry_interval=15');


Answered By - Chhavi Gangwal
Answer Checked By - Katrina (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing