memcached extension check in browser
0

We have actually a few articles about Varnish, a technology that is popular cache your website in server’s memory / RAM and therefore it can boost the speed of your website and enlighten your server load. Today, I will show you another caching that is in-memory which can be early in the day and much more popular than Varnish Cache. Meet Memcached! In type, it’s a distributed caching that is in-memory that stores key-value pairs in your server’s RAM. The purpose of using this technology is still the same: to turbo boost your site performance as well as reducing server load that is heavy avoiding regular questions to database. Memcached (pronounced: mem-cash-dee that is********)(, or Memcache-daemon, is a procedure that listens automagically on slot 11211.

Installing memcached will demonstrably be great for sites having traffic that is tremendous. Many users keep wondering how they can build a server that is perfect host their sites having glorious variety of day-to-day site visitors and unique views and never have to invest hundreds bucks 30 days leasing a separate host. Luckily for us, making use of content caching device to particular degree are therefore of use and competent to cope with such situation. Numerous CMS apps like WordPress have actually plugins like W3TC, WP Super Cache, and so forth. Often it may be additionally handy. But script-based caching isn’t the absolute most method that is sustainable. Hence, some people opt to combine script-based and caching that is server-side develop more sustainable (and may be unbeatable) host performance.

Again, inside make suggestions might find all necessary actions that are very easy to install Memcached on Ubuntu 16.04 host and configure it working side-by-side with Nginx, PHP7 php7-fpm that is( and MySQL.

Requirements

  1. A SSH customer like Bitvise or Putty and knowledge that is basic utilizing it.
  2. Basic information about typical Unix demand to SSH towards host.
  3. A host or VPS with at the very least 256MB of RAM (OpenVZ) but 512MB is preferred if you use KVM or Xen.
  4. Ubuntu 16.04 either 32-bit or 64-bit.
  5. About 15 mins of energy.
  6. a walk or tea.

Confused on selecting which VPS provider to create an Apache based server that is hosting? Read my recommended VPS providers or this list of top end that is low host providers. Quick suggestion: Digital Ocean, Atlantic.net or Ramnode.

In this guide i will be making use of a 512MB RAM Cloud VPS from Atlantic operating Ubuntu 16.04 X that is*****************************************************************************************************)(. Regrettably, Atlantic has power down its 512MB plan so I’ve been therefore happy to help keep it.

Do keep in mind to constantly change domain.tld with your personal domain title and replace x.x.x.x along with your host ip.

PREREQUISITES

  1. Provision a cloud host on Atlantic.net (if you would like).
  2. Install complete LEMP stack (latest Nginx, PHP7, and MySQL) in your Ubuntu 16.04 host.
  3. Setup brand new site in your LEMP host (produce Server obstructs).
  4. Install WordPress on LEMP host if you would like (optional).

Let’s Install Memcached

Step 1 – Login towards host as root or as a person with root privilege (sudo).

login ubuntu 1604

Step 2 – improve your host apt initially. it is optional nonetheless it’s a practice that is common

apt-get change -y

Step 3 – Then, if you have set up LEMP that is full stack you’ve got create Nginx Server Block for the site, it’s simple to merely install memcached straight by typing this demand :

apt install memcached

apt install memcached ubuntu 1604

Step 4 – you will must install needed php expansion for memcached :

apt install php-memcached

install php memcached extension

Step 5 – Now make memcache that is sure is operating on your host by issuing after demand :

ps aux | grep memcached

You should see something such as this :

memcached daemon running

Step 6 – additionally always check whether memcached expansion is precisely configured in PHP7 by producing info.php web page. Presuming your internet site is servermom.xyz, as described in my own guide that is previous the demand will be

nano /etc/var/www/servermom.xyz/html/info.php

and place this code that is simple there :

<?php

phpinfo();

?>

Save that file then leave Nano editor by pushing Control+O and Control+X correspondingly.

php info file tes

Step 7 – Now restart both memcached and php7-fpm solutions :

service memcached restart

solution php7.0-fpm restart

restart memcached daemon

Step 8 – Now introduce your web that is favorite browser access the newly produced info.php file and always check whether memcached expansion is completely packed.

check memcahced extension

memcached extension check in browser

Test Memcached Daemon

Step 1 – Create a cache_test.php file. This may perform a object that is simple in your host ensuring Memcached daemon is working precisely.

nano /var/www/servermom.xyz/html/cache_test.php

and place this scripts inside:

<?php

$mem = Memcached( that is new)

$;addServer that is mem-&gt"127.0.0.1", 11211);



$outcome = $mem->get("blah");



if ($outcome) {

    echo $outcome;

} {else {(|else that is{}**********************************************************************************************************);
    echo "no key that is matching yet. Let us begin including that now!";

    $;set that is mem-&gt"blah", "I am data!  I am held in memcached!") or die("Couldn't save anything to..." that is memcached;

}

?>

Save that (Control+O) exit the editor then (Control+X).

Step 2 – start browser once again and access that file. You will observe something such as this on time that is first

test cache memcached

Step 3 – struck the button that is refresh you’ll see something such as this showing memcached is effective.

memcached test success

Congratulation. Memcached works!

Configuring WordPress

Assuming you’ve got complete LEMP installed, Memcached installed and operating, along with WordPress create.

First, you must additionally install memcache customer to make plugin like w3 Cache that is total can utilization of memcached abilities :

issue this demand :

apt install memcache

install memcache client

and don’t neglect to restart service:( that is php-fpm************)

service php7.0-fpm restart

Now all you have to do is currently to put in supporting plugin like w3 Cache that is total Object Cache, Cachify, and so on. Personally, I prefer to use some plugins that are simple MemcacheD can be your Friend coupled with caching plugin like Cache Enabler or WP Super Cache. It really works for me personally.

Thanks!

About The Author

How exactly to Install NetBeans IDE 8.2 in Debian, Ubuntu and Linux Mint

Previous article

Helpful tips to utilising the Django Framework

Next article

You may also like

Comments

Leave a reply

Your email address will not be published. Required fields are marked *

More in Apache