Checking Memcached Usage on WordPress Site?

Cheerag Nundlall

Well-known member
Registered
Joined
Oct 12, 2016
Messages
336
Points
18
Hello everyone,

I'm seeking guidance on how to check if my WordPress site is utilizing Memcached or not. Could anyone provide instructions or tips on how to verify the usage of Memcached in my WordPress setup?

Your help would be greatly appreciated. Thank you!
 

AlbaHost

Well-known member
Moderator
Hosting Provider
Joined
Jan 18, 2017
Messages
809
Points
43
Create a file whatevername.php and put this code in it:

Code:
<?php
phpinfo();
?>
and:

Code:
<?php

try

{
    $memcached = new Memcached();
    $memcached->addServer("127.0.0.1", 11211);
    $response = $memcached->get("sample_key");
 
    if($response==true)
    {
      echo $response;
    }

    else

    {
    echo "Cache is empty";
    $memcached->set("sample_key", "Sample data from cache") ;
    }
}
catch (exception $e)
{
echo $e->getMessage();
}
?>
visit that file and you will know if is it using or not.
More: https://www.alibabacloud.com/blog/how-to-set-up-memcached-with-php-on-ubuntu-18-04_595628
 

Cheerag Nundlall

Well-known member
Registered
Joined
Oct 12, 2016
Messages
336
Points
18
On my server, when checking via SSH, I can see that Memcached is running. However, when I inspect the Memcached module in the PHP info file, it doesn't appear as indicated in the blog post I referred to.
 

AlbaHost

Well-known member
Moderator
Hosting Provider
Joined
Jan 18, 2017
Messages
809
Points
43
Make sure you have memcached php extension installed/enabled.
 

Cheerag Nundlall

Well-known member
Registered
Joined
Oct 12, 2016
Messages
336
Points
18
When i run this command in SSH

ps aux | grep memcached
memcach+ 1098 0.0 0.0 373948 32540 ? Ssl Nov11 13:41 /usr/bin/memcached -u memcached -p 11211 -m 1524 -c 15240
root 11867 0.0 0.0 110804 908 pts/0 S+ 16:48 0:00 grep --color=auto memcached

or this command


systemctl status memcached
● memcached.service - Memcached
Loaded: loaded (/usr/lib/systemd/system/memcached.service; enabled; vendor preset: disabled)
Active: active (running) since Sat 2023-11-11 06:03:54 CET; 2 weeks 5 days ago
Main PID: 1098 (memcached)
CGroup: /system.slice/memcached.service
└─1098 /usr/bin/memcached -u memcached -p 11211 -m 1524 -c 15240

Nov 11 06:03:54 srv.myserverdm.com systemd[1]: Started Memcached.


I saw memcached there but I think my wordpress is not running with it
 

HostShark

Member
Registered
Joined
Aug 15, 2023
Messages
28
Points
1
Did you install the PHP extension?

Install Memcached PHP extension

Now, install a PHP extension to work with the Memcached daemon.

# yum install php-pecl-memcache
Install Memcached Perl Library
Install Perl library for Memcached.

# yum install perl-Cache-Memcached
Install Memcached Python Library
Install python library for Memcached.

# yum install python-memcached
Restart Web Server
Restart the Apache or Nginx service to reflect changes.

# systemctl restart httpd
# systemctl restart nginx
 

Mjlivera

Member
Registered
Joined
May 12, 2013
Messages
31
Points
6
If you want to check if your WordPress site is using Memcached, there are a few ways you can do it. First, you can look at your site’s wp-config.php file to see if there’s a line mentioning Memcached or an object cache setup. Another way is to install a plugin like “Query Monitor,” which can show you if Memcached is being used for object caching. Additionally, you can check with your hosting provider—they often enable Memcached on their end, so they should be able to confirm if it’s active on your site. If you’re comfortable with command line access, you can also connect to your server and use commands to check if Memcached is running. These steps should help you determine if Memcached is part of your WordPress setup.
 
Latest Threads
Replies
0
Views
122
Replies
1
Views
77

Latest Hosting OffersNew Reviews

Sponsors

Tag Cloud

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Top