• Resolved MarkOlbert

    (@markolbert)


    Kudos for a truly awesome-looking caching plugin! I’m hard pressed to imagine some aspect of WP it >>doesn’t<< cache.

    However, I am having trouble getting it to recognize and use memcached. This is on a Debian 10 system, all updates installed.

    I’ve tried to follow the instructions on your github site that the plugin refers you to. But it didn’t work. When I do the “final” step of running php -r 'phpinfo();' | grep 'memcache', I get nothing back.

    I think the problem may be related to the memcached.ini file not being in the right place. The instructions call for it to be placed in /etc/php.d…but on my debian 10 system, there is no /etc/php.d directory. Instead, there’s an /etc/php directory, which contains a number of subdirectories, one for each version of php installed.

    I tried putting the ini file in /etc/php/7.4/mods-available and then restarting apache2, but that didn’t work. I’ve confirmed my site is using PHP7.4 (as it should).

    There are also directories for apache2, fpm and cli (/etc/php/7.4/apache2, /etc/php/7.4/fpm, /etc/php/7.4/cli). Does the ini file belong in one of those, instead? Based on the contents of those directories I don’t think so, but…

    Also, I see references online to having to install an object-cache.php file in wp-content. I don’t recall seeing that in the installation instructions. Is the file necessary? If so, where do I find it?

    • This topic was modified 1 year, 10 months ago by MarkOlbert.

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @markolbert

    Thank you for reaching out and I am happy to assist you with this.
    As you can see in the General settings, specifically the Object Cache section you are referring to, Memcached is available as a caching method besides Disk, Redis and others. In order to use Memcached as a caching method, you need to install the Memcached PHP extension on your server. The reason for this is that W3 Total Cache can only recognize the PHP extension.
    You mentioned that you followed the instructions on our FAQ page. and there you can see that for Debian / Ubuntu
    you can use: apt-get -y install memcached
    You can also check this video for more detailed instructions.
    Check the service at the CLI/SSH: memcached-tool 127.0.0.1:11211 display and memcached-tool 127.0.0.1:11211 stats.
    Look if the service is running: ps afux | grep memc
    Restart the service if needed (as root/sudo): service memcached restart

    As for the object-cache.php, this is a W3 Total Cache drop-in file, and it’s added in the wp-content by the W3 Total Cache once Object Cache is enabled in the general settings.
    You can test this by simply enabling the Object Cache option in Performance>General settings. Make sure to save all settings and purge the cache.

    I hope this helps!

    Thanks!

    Thread Starter MarkOlbert

    (@markolbert)

    Thanx for the detailed reply. Here’s what I found based on your suggestions. FYI, I had to manually create a link to memcached-tools because the debian install package doesn’t do that for some reason.

    > memcached-tool 127.0.0.1:11211 display
      #  Item_Size  Max_age   Pages   Count   Full?  Evicted Evict_Time OOM
    > ps afux | grep memc
    mark     27377  0.0  0.0   7796   828 pts/0    S+   21:11   0:00              \_ grep memc
    memcache 25108  0.0  0.0 408164  1040 ?        Ssl  Dec08   0:15 /usr/bin/memcached -m 64 -p 11211 -u memcache -l 127.0.0.1 -P /var/run/memcached/memcached.pid
    memcached-tool 127.0.0.1:11211 stats
    
    #127.0.0.1:11211   Field       Value
             accepting_conns           1
                   auth_cmds           0
                 auth_errors           0
                       bytes           0
                  bytes_read          66
               bytes_written        1998
                  cas_badval           0
                    cas_hits           0
                  cas_misses           0
                   cmd_flush           0
                     cmd_get           0
                     cmd_set           0
                   cmd_touch           0
                 conn_yields           0
       connection_structures           2
       crawler_items_checked           0
           crawler_reclaimed           0
            curr_connections           1
                  curr_items           0
                   decr_hits           0
                 decr_misses           0
                 delete_hits           0
               delete_misses           0
             direct_reclaims           0
              evicted_active           0
           evicted_unfetched           0
                   evictions           0
           expired_unfetched           0
                 get_expired           0
                 get_flushed           0
                    get_hits           0
                  get_misses           0
                  hash_bytes      524288
           hash_is_expanding           0
            hash_power_level          16
                   incr_hits           0
                 incr_misses           0
                    libevent 2.1.8-stable
              limit_maxbytes    67108864
         listen_disabled_num           0
            log_watcher_sent           0
         log_watcher_skipped           0
          log_worker_dropped           0
          log_worker_written           0
           lru_bumps_dropped           0
         lru_crawler_running           0
          lru_crawler_starts       13260
      lru_maintainer_juggles       81416
           lrutail_reflocked           0
                malloc_fails           0
             max_connections        1024
               moves_to_cold           0
               moves_to_warm           0
            moves_within_lru           0
                         pid       25108
                pointer_size          64
                   reclaimed           0
        rejected_connections           0
                reserved_fds          20
               rusage_system    7.801194
                 rusage_user    8.117724
       slab_global_page_pool    0
    slab_reassign_busy_deletes    0
    slab_reassign_busy_items    0
    slab_reassign_chunk_rescues 0
    slab_reassign_evictions_nomem 0
    slab_reassign_inline_reclaim 0
       slab_reassign_rescues     0
       slab_reassign_running     0
                 slabs_moved     0
                     threads     4
                        time  1670620338
    time_in_listen_disabled_us   0
           total_connections     5
                 total_items     0
                  touch_hits     0
                touch_misses     0
                      uptime     81379
                     version     1.5.6
    

    BTW, I enabled Object Cache in General Settings, but hadn’t done that earlier because the only option I was allowed to select from the corresponding Object Cache Method dropdown was “Disk”…which seemed wrong, since I was trying to set up memcached (which I could not select from the dropdown).

    Does the Disk option for Object Cache mean memcached is being used? Or is the fact that’s the only option I can select mean something is wrong in the installation or configuration?

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @markolbert

    Thank you for your feedback.
    Are you now able to select Memcached as a caching method?
    The Disk option for any caching feature is the default option. The reason for this is that, if you are on a shared server, those memory-based caching methods may be unavailable.
    So, in the Performance>General settings, under the Object Cache>Object Cache Method: You should be able to select Memcached from a Dropdown menu if of course the Memcache PHP is installed and enabled on your server.
    This is the case for any other caching methods. W3 Total Cache detects if any of the PHP modules are installed (Redis, Memcached, APC…), and if those are not installed/enabled, the option is going to be greyed out (undetectable)

    I hope this answers your question let me know if I can assist you further.

    Thanks!

    Thread Starter MarkOlbert

    (@markolbert)

    Sorry about the delay in replying.

    I cannot select Memcached (I’d upload a screenshot but I don’t see how to do that on a reply). The Memcached option in the dropdown is under “Multiple Servers”, which doesn’t fit my situation (the WordPress site and memcached are running on the same server).

    No offense, but the problem may well be that the instructions you guys provided for installing memcached are pretty complicated, somewhat unclear, and aren’t based on debian systems, which is what I’m using.

    Do you have command line diagnostics I can run to see if some required component is missing and keeping memcache from working correctly with your plugin? I know it’s running (as per the info I provided earlier) so I think the problem is some part of the “glue” between memcache and your plugin is missing or not configured correctly. But I have no idea what that might be.

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @markolbert

    Thank you for your feedback. Just a quick question, have you tried reaching out to yoru hosting provider and asking for assistance in installing the PHP Memcached based on the video I shared with you?

    Thanks!

    Thread Starter MarkOlbert

    (@markolbert)

    I’ve talked to my hosting provider, and he is as confused as I am.

    Then again, that’s because I’m also the hosting provider :). The site runs on a VPS I rent.

    I’m reasonably proficient with Debian, so if there are diagnostics you’d like me to run, send them along.

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @markolbert

    Thank you for your feedback. In the video I shared should be enough info for this. Again, i must mention that W3 Total Cache only recognizes the PHP extension so the PHP memcached needs to be installed in order for W3 Total Cache to be able to detect it. Once installed properly it will be available to select as a caching method.
    You can also try this article which explains how to How to Install Memcached on Debian

    To use Memcached as a caching database for your?PHP?application such as WordPress, Drupal or, Magento, you need to install the?php-memcached?extension:

    $ sudo apt install php-memcached

    I hope this helps!

    Thanks!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Can’t Get Object Cache Recognized’ is closed to new replies.