[solved] PHP APC Opcode cache issues

Discussion in 'PHP' started by iso99, Apr 15, 2014.

  1. iso99

    iso99 New Member

    Hi guys,

    I have a few problems regarding APC cache. I used SuEXEC Daemon and got APC to work properly for 4 hours. I tried to increase shm size to 2GB, however, litespeed seems to crash and websites don't work. When I reduce it to 1gb, it works again.

    Also, is it alright for APC to be enabled system-wide in a shared hosting environment?

    Thank you.
  2. NiteWave

    NiteWave Administrator

    2GB should not be a problem.
    I know a user set shm=6GB and working fine. his APC version is 3.1.13, lsphp version is 5.3.28
    it's known APC not working well with php 5.4 and above.
    what's the lsphp's
    Memory Soft Limit (bytes)
    Memory Hard Limit (bytes) ?
    they should be larger than 2G in your case.

    it's ok.
  3. iso99

    iso99 New Member

    What sort of issues should I be expecting? I'm using PHP 5.4 currently.

    Soft & Hard limit: 2047M

    If I increase shm size, I should always make sure these limits are also increased right?

    I still have the default litespeed configs.


    Thanks a lot!
  4. NiteWave

    NiteWave Administrator

    soft/hard limit is ok.

    APC is not working well with php 5.4 or 5.5. this is APC's issue. you've to use XCache or OPcache (http://www.php.net/manual/en/book.opcache.php) if you use php 5.4.

    or you use php 5.3, which works well with apc.
  5. iso99

    iso99 New Member

    I followed your advice, opted for Opcache instead.

    I have a few questions though. Is the memory consumption limit applied globally or per user shared memory? Also, I used opcache-gui-master for monitoring and find that the file usage only displays cached files for that certain user. Seems odd, it works a lot different than apc. Note that I have CageFS enabled and I'm not sure if this is what causing it.

    Thanks a lot!
  6. NiteWave

    NiteWave Administrator

    >Is the memory consumption limit applied globally or per user shared memory?
    neither. per lsphp5 process. a user may launch a few lsphp5 processes.

    >Note that I have CageFS enabled and I'm not sure if this is what causing it.
    Can you disable CageFS for a while to see if any difference ?
    lsws web admin->Configuration->Server->General->Cloud Linux: Disabled
  7. iso99

    iso99 New Member

    Disabled CageFS, still same results. However, I placed the script on separate domains and I confirm that opcache is working. The downside is I can't seem to monitor which files are being cached globally - from a single domain. It would be better if Zend will release their own GUI :)

    Thanks for the help NiteWave! I really appreciate it.
  8. NiteWave

    NiteWave Administrator

    XCache has settings of
    xcache.admin.user
    xcache.admin.pass
    xcache.admin.enable_auth, default is on.
    (refer http://xcache.lighttpd.net/wiki/XcacheIni)
    this is to prevent one user can know any info of other user's php script in xcache admin page.

    e.g., xcache has this built-in mechanism
    but looking at OPCache's configuration manul - http://www.php.net/manual/en/opcache.configuration.php
    no such settings found.

    so I'm not sure either how opcache-gui-master separate user from seeing each other... what's the link of opcache-gui-master you refer ?
  9. iso99

    iso99 New Member

  10. NiteWave

    NiteWave Administrator

    Thanks. I've quickly gone through the source code, still not understand why yet.
    but if you choose xcache, you can see the cached php scripts globally as long as you set those 3 parameters correctly.
    xcache.admin.user
    xcache.admin.pass
    xcache.admin.enable_auth
  11. iso99

    iso99 New Member

    Yep, xcache does have this, used this on a separate server. Will try it instead of opcache and see what would work for me.

    Thanks a lot!
  12. iso99

    iso99 New Member

    Hi there!

    I got opcache working properly, very bad mistake on my part. Apparently, I switched from suexec daemon to suexec worker at some point. I checked today and lsphp was not set to suexec daemon. Changed the settings back again and opgui is now showing all cached files. :p

    Thanks.
  13. NiteWave

    NiteWave Administrator

    Thank you for the update!

    so only xcache is ok for shared hosting.
    while showing all accounts' cached files is good for your case, it's a security risk in shared hosting environment. :)
  14. iso99

    iso99 New Member

    I'm actually using zend opcache. Yep, I understand that. Would you recommend listing critical opcache functions in disabled_functions?
  15. NiteWave

    NiteWave Administrator

Share This Page