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

Sunday, November 13, 2022

[FIXED] how to use FOSUSERBUNDLE and MEMCACHED?

 November 13, 2022     fosuserbundle, memcached, php, session, symfony     No comments   

Issue

I injected the services.yml like that

services:
    memcache:
        class: Memcache
        calls:
            - [ addServer, [ %session_memcached_host%, %session_memcached_port% ]]  
    session.handler.memcache:
            class: Symfony\Component\HttpFoundation\Session\Storage\Handler\MemcacheSessionHandler
            arguments: [@memcache]

and my config.yml

handler_id: session.handler.memcache

and my php.ini

    extension="memcache.so"
    session.save_handler= memcache

    session.save_path= tcp://127.0.0.1:11211

and i installed memcached using this link but the problem when i load fosbundle login page i get this error

Attempted to load class "Memcache" from the global namespace.
Did you forget a "use" statement?

Solution

An easy way to integrate symfony with memcached is to use an existing bundle. I use leaseweb/memcache-bundle and it's super simple - just follow the instructions here: https://github.com/LeaseWeb/LswMemcacheBundle. And remember to start memcached first ;)

Yet to integrate this fully with FOSUserBundle, however it does support php sessions.



Answered By - beterthanlife
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