• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here: Home » How To Install Memcached on Ubuntu Server And Configure WordPress

By Abhishek Ghosh September 1, 2018 9:27 am Updated on September 1, 2018

How To Install Memcached on Ubuntu Server And Configure WordPress

Advertisement

In previous guide, we installed APC cache on Ubuntu 18.04. Here Are The Steps On How To Install Memcached on Ubuntu Server 16.04, 18.04 And Configure WordPress To Optimize Page Loading Speed. APC is an opcode cache. APC cache chunks of PHP code and stores it in RAM. When we need to run that same piece of code again APC already cached it and runs from memory at lightning fast. An opcode cache is one that compiles the plain PHP code into machine code (opcode) and then stores it in the compiled form for future requests until it detects the original PHP file has changed. This means that PHP does not have to run this compile step on every single request, saving some time.

Memcache or Redis are in-memory data-store, used as a cache for your WordPress site data. Although both are cache system and sounds closer, they are technically not same. Everything really depends on your server. A cluster of small servers at lower cost can distribute load and make site load loading almost instantly. APC does not share the cache with other servers but possibly it is faster to cache code.

In short, memcached is a distributed caching system, whereas APC cache is a non-distributed cache and mainly an opcode cache. If your WordPress live on different webservers for loadbalancing then you have to use memcached for distributed caching. If not, you can stick to APC cache. You should always use asome opcode cache. You can/should use both of them for different purposes.

Advertisement

---

 

Steps of How To Install Memcached on Ubuntu Server

 

You should have installed Apache2, PHP on Ubuntu 16.04 or 18.04 in our described way. SSH as root. Run :

Vim
1
2
apt update -y
apt upgrade -y

First install the dependencies, search apt with php72-devel to find some php-devel for your version of PHP :

Vim
1
apt install make php72-devel gcc glibc-devel zlib-devel libmemcached-dev libmemcached11 git build-essential

Install memcache :

Vim
1
2
apt install memcached
service memcached start

Install PHP memcached (d means daemon) :

Vim
1
2
pecl install memcached
# sudo apt install php-memcached

Add this line to php.ini under the php version you installed memcached php (like :/etc/php/7.0/mods-available for PHP 7.0) or under Apache’s php.ini directory (like /etc/php/7.0/apache2/php.ini) :

Vim
1
extension=memcached.so

If you have Apache2 running, then reload :

Vim
1
service apache2 restart

If you run :

Vim
1
php -i | grep "memcached support"

You’ll get :

Vim
1
memcached support => enabled

Run :

Vim
1
echo "stats settings" | nc localhost 11211

11211 is the default port where memcached runs. Run :

Vim
1
php -r 'phpinfo();' | grep -i 'memcached'

You’ll get output like this :

Vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/etc/php/7.2/cli/conf.d/20-memcached.ini,
memcached
memcached support => enabled
libmemcached version => 1.0.18
memcached.compression_factor => 1.3 => 1.3
memcached.compression_threshold => 2000 => 2000
memcached.compression_type => fastlz => fastlz
memcached.serializer => php => php
memcached.sess_binary => 0 => 0
memcached.sess_connect_timeout => 1000 => 1000
memcached.sess_consistent_hash => 0 => 0
memcached.sess_lock_expire => 0 => 0
memcached.sess_lock_max_wait => 0 => 0
memcached.sess_lock_wait => 150000 => 150000
memcached.sess_locking => 1 => 1
memcached.sess_number_of_replicas => 0 => 0
memcached.sess_prefix => memc.sess.key. => memc.sess.key.
memcached.sess_randomize_replica_read => 0 => 0
memcached.sess_remove_failed => 0 => 0
memcached.sess_sasl_password => no value => no value
memcached.sess_sasl_username => no value => no value
memcached.store_retry_count => 2 => 2
memcached.use_sasl => 0 => 0
Registered save handlers => files user memcache memcached

So the effective settings file is /etc/php/7.2/cli/conf.d/20-memcached.ini. If you run just :

Vim
1
php -i

You’ll receive information about memcache and memcached.

How To Install Memcached on Ubuntu Server And Configure WordPress

How to configure WordPress with memcached has been discussed in the article WordPress High Load Average With W3 Total Cache.

If you are not using W3 Total Cache, you just need to install WordPress plugin like Memcached Redux, instead of activating it, copy the object-cache.php from plugin directory to wp-content directory.

Tagged With wordpress memcached ubuntu

This Article Has Been Shared 785 Times!

Facebook Twitter Pinterest

Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to How To Install Memcached on Ubuntu Server And Configure WordPress

  • How to Install Virtualmin/Webmin on Ubuntu 16.04

    Many Users Want A Free cPanel Like Web Hosting Control Panel. Virtualmin is Free. Here is How to Install Virtualmin/Webmin on Ubuntu 16.04.

  • How To Install TICK Stack on Ubuntu, CentOS For System Metrics Monitoring

    TICK Stands For Telegraf, InfluxDB, Chronograf, Kapacitor. Here is How To Install TICK Stack on Ubuntu, CentOS For System Metrics Monitoring.

  • Best Tools For Web Server Log Processing & Statistics Running WordPress

    Commonly We Run One Server One WordPress Website Setup. Here Are Some Best Tools For Web Server Log Processing & Statistics Running WordPress Which Are Self-Hosted.

  • How to Install Silex : Static Website Builder on Ubuntu Server

    Silex is a F/OSS Static Website Editor Intended to be Accessed via Browser to Host Sites on Cloud Storages. Here is How to Install Silex Static Website Builder on Ubuntu Server.

  • How To Install Apache2 on Ubuntu 18.04 With Let’s Encrypt, HTTP/2, HSTS

    Here is Detailed Guide on How To Install Apache2 on Ubuntu 18.04 With Let’s Encrypt, HTTP/2, HSTS With Commands and Configurations For Most Secured Setup.

Additionally, performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Subscribe To Our Free Newsletter

Get new posts by email:

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (24.3K Followers)
  • Twitter (5.8k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • What is Voice User Interface (VUI) January 31, 2023
  • Proxy Server: Design Pattern in Programming January 30, 2023
  • Cyberpunk Aesthetics: What’s in it Special January 27, 2023
  • How to Do Electrical Layout Plan for Adding Smart Switches January 26, 2023
  • What is a Data Mesh? January 25, 2023

About This Article

Cite this article as: Abhishek Ghosh, "How To Install Memcached on Ubuntu Server And Configure WordPress," in The Customize Windows, September 1, 2018, January 31, 2023, https://thecustomizewindows.com/2018/09/how-to-install-memcached-on-ubuntu-server-and-configure-wordpress/.

Source:The Customize Windows, JiMA.in

PC users can consult Corrine Chorney for Security.

Want to know more about us? Read Notability and Mentions & Our Setup.

Copyright © 2023 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy

We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept”, you consent to the use of ALL the cookies.
Do not sell my personal information.
Cookie SettingsAccept
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
SAVE & ACCEPT