1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

APC Installed! Please review my configuration file

Discussion in 'Server Configuration and Hosting' started by TheBigK, Jun 21, 2013.

  1. TheBigK

    TheBigK Well-Known Member

    I've APC installed and have following entries in my configuration file-

    Code:
    $config['cache']['enabled'] = true;
    $config['cache']['frontend'] = 'Core';
    $config['cache']['enabled'] = true;
    $config['cache']['frontend'] = 'Core';
    $config['cache']['frontendOptions']['cache_id_prefix'] = 'xf_';
    
    $config['cache']['cacheSessions'] = true;
    $config['cache']['backend'] = 'Apc';
    I've noticed the following-

    1. I'm getting logged out frequently.

    2. I tried to set the following, but I got 'Unexpected Error Ocurred' error on all the pages when I saved the configuration file with following settings -

    Code:
    $config['cache']['frontendOptions'] = array(
                                            'caching'                      => true,
                                            'automatic_serialization'      => true,
                                            'lifetime'                      => 10800,
                                            'cache_id_prefix' => 'foro'
    );
    What am I doing wrong?
     
  2. Slavik

    Slavik XenForo Moderator Staff Member

    1) You probably have a setitng somewhere flushing out your cached files too often.

    2) Are you just adding this or replacing something else?
     
  3. CyclingTribe

    CyclingTribe Well-Known Member

    I'm not sure if you can specify APC as your backend cache (try installing Libmemcached for that) - so try this config:

    Code:
    $config['cache']['enabled'] = true;
    $config['cache']['frontend'] = 'Core';
    $config['cache']['frontendOptions'] = array('caching'  =>  true,
      'cache_id_prefix'  =>  'xf_'
    );
    
    Any good?
     
    Last edited: Jun 21, 2013
  4. TheBigK

    TheBigK Well-Known Member

    I'm following the guide here - http://xenforo.com/help/cache/ . It clearly says backend cache could be APC. I'm replacing simple 'file' based cache with APC.
     
  5. CyclingTribe

    CyclingTribe Well-Known Member

    So it does. :D I suspect your sessions data is being flushed when APC purges its cache, so try removing the cacheSessions line and see how that goes. (y)
     
  6. TheBigK

    TheBigK Well-Known Member

    Note: using: $config['cache']['backend'] = 'File'; works without any issues, no logging out.
     
  7. CyclingTribe

    CyclingTribe Well-Known Member

    Yeah, I think this is APC cache flushing taking your sessions data with it. Remove the cacheSessions line or install an alternative backend cache such as Libmemcached. (y)
     
  8. MattW

    MattW Well-Known Member

    What do you use for the PHP handler (suPHP/DSO/FastCGI)?

    Also, install the apc.php script that comes with APC so you can see what the cache is actually doing.
     
  9. TheBigK

    TheBigK Well-Known Member

    Well, where would the sessions be stored then?
     
  10. TheBigK

    TheBigK Well-Known Member

    We're on lightspeed and I think we're using DSO (will have to check again). I've access to apc.php; which settings/area should I look at?
     
  11. MattW

    MattW Well-Known Member

    That will tell you how long APC has been running for. If APC keep restarting, then it will be flushing all the session information out.
     
  12. The Forum Heroes

    The Forum Heroes Well-Known Member

    DSO doesn't cache correctly using Lite Speed, you want to use FastCGI
     
  13. TheBigK

    TheBigK Well-Known Member

    Okay, how long should I keep it on for?
     
  14. MattW

    MattW Well-Known Member

    What does it say currently? APC should remain up as long as the webserver does.
     
  15. TheBigK

    TheBigK Well-Known Member

    After switching back to file cache, the uptime is '0'. :oops:
     
  16. CyclingTribe

    CyclingTribe Well-Known Member

    Just give this config a try and let me know what happens:

    Code:
    $config['cache']['enabled'] = true;
    $config['cache']['frontend'] = 'Core';
    $config['cache']['frontendOptions'] = array('caching'  =>  true,
      'automatic_serialization' => true,
      'lifetime'  => 10800,
      'cache_id_prefix'  =>  'xf_'
    );
    $config['cache']['backend'] = 'Apc';
    
    Sessions should be cached to file and you should begin to see the APC cache fill with compiled PHP files.

    NB: As per your note earlier in the thread - you may need to simplify the frontendOptions element to just the cache_id_prefix if the other lines cause a problem.

    Cheers,
    Shaun :D
     
  17. TheBigK

    TheBigK Well-Known Member

    It continued to throw me out of the board. I noticed that the 'Uptime' as reported in the apc.php is '0', but it continousouly shows the memory allotment changing.
     
  18. CyclingTribe

    CyclingTribe Well-Known Member

    Ah, okay, well unfortunately I don't have any direct experience with LiteSpeed so can't help you dig into it any further, sorry. Let us know what the resolution is though, when you do get it sorted. (y)
     
  19. Moshe1010

    Moshe1010 Well-Known Member

    APC did many problems on my system, especially with PHP 5.4 (APC doesn't really support it. It's in its beta stage for years already). Try installing XCache instead and see if that solves your problem.
     
  20. Tracy Perry

    Tracy Perry Well-Known Member

    I haven't had any problems with it. Granted, most of my "users" are spammers trying to hit - but I would figure if it was unstable it would still rare it's ugly head.
    example.png
     

Share This Page