Installing memcache and memcached server on Ubuntu / ~#root -i Installing memcache and memcached server on Ubuntu / ~#root -i Installing memcache and memcached server on Ubuntu / ~#root -i Installing memcache and memcached server on Ubuntu / ~#root -i Installing memcache and memcached server on Ubuntu / ~#root -i Installing memcache and memcached server on Ubuntu / ~#root -i Installing memcache and memcached server on Ubuntu / ~#root -i Installing memcache and memcached server on Ubuntu / ~#root -i
  • RU
  • UA
  • EN
  • Create an online store
  • Documentation
  • Blog
    • Unix ОS
    • Php
    • MySQL
    • JavaScript
    • Package Managers
    • Docker
    • Seo
  • Auxiliary services
    • Short Links
    • Exchange views YouTube
  • Sign in
  • Create Account
  • Home
  • Unix OS
  • Installing memcache and memcached server on Ubuntu

Installing memcache and memcached server on Ubuntu

Consider the difference between memcache and memcache

Everything is simple with memcache. Memcache is a php extension that allows you to work with memcached server.

memcached has 2 concepts. memcached server and memcached php extension.

Both the memcache extension and the memcached extension are designed to work with the memcached caching server. The difference between memcache and memcached is only in the set of tools for communicating with the server.

The memcache extension is simpler and faster, it should be enough for simple tasks, bring it into the cache and take it out of the cache.

The memcached extension is more resource intensive and has a more advanced set of tools.

My configuration uses php 5.6 and Ubuntu 14.04.

Installing the memcached server :

sudo apt-get install memcached

memcached server configuration file :

nano /etc/memcached.conf

If you need to make changes to the configuration.

Start :

sudo service memcached start

If the server did not rise automatically, you should raise it with this command.

Check :

netstat -a | grep 11211

-a - display all sockets

11211 - port on which memcache runs by default.

If the console finds a localhost entry with this port, then the server is up and ready to go.

memcached netstat

Installing memcache extension for php5.6 :

sudo apt-get install php5.6-memcache

Checking in phpinfo() :

memcache phpinfo

Combat check :

<?php
if (class_exists('Memcache')) {
    $memcache = new Memcache;
    $connect = @$memcache->connect('localhost');
    if ($connect) {
        $aData = $memcache->get('data');
        echo '<pre>';
        if ($aData) {
            echo '<h2>Data FROM CACHE:</h2>';
            print_r($aData);
        } else {
            $aData = array('Test data');
            echo '<h2>NON-CACHE data:</h2>';
            print_r($aData);
            $memcache->set('data', $aData, 0, 300);
        }
        $aData = $memcache->get('data');
        if ($aData) {
            echo '<h3>Memcache works</h3>';
        } else {
            echo '<h3>Memcache not working</h3>';
        }
        echo '</pre>';
    }
}
if (!$connect) {
    echo 'No memcache';
}

We place the code in the project and run it. If everything worked out, then the first occurrence of the code will give the message "Data NOT FROM CACHE", and the second occurrence will give "Data FROM CACHE".

09 July 18
1519
0

Comments

Name
E-mail
Rating
Review

Other articles from the category

28 September 2022

Configuration file (php.ini) when running Cron (cli) changing parameters (memory_limit) on hosting

Let's consider the possibility of changing the parameters of the configuration file (php.ini) on a hosting that does not have the ability to configure the Cron scheduler (cli) from the panel.

12 August 2022

Ubuntu Apache 2.4 Bad Request Size of a request header field exceeds server limit

Configuring Apache for high volume Cookies. Let's analyze the error "Bad Request. Your browser sent a request that this server could not understand. Size of a request header field exceeds server limit." and options to configure the server.

26 May 2022

Ubuntu black screen after driver installation on Nvidia 630M

Let's try to cure the black screen when booting Ubuntu after installing proprietary nvidia-340 driver on Nvidia 630M laptop.

06 January 2022

USB not working after Ubuntu 18.04 update on laptop

When USB 2.0-3.0 stopped working after updating Ubuntu on a laptop.

18 December 2021

Running Skype (skypeforlinux) in multiple Ubuntu windows

Ability to run Skype in multiple windows. Installed on Ubuntu skypeforlinux run in 2 windows.

23 March 2020

Disabling bluetooth speakers, dos attack on bluetooth in Linux

Let's consider one of the ways to dos-attack on bluetooth through the basic l2ping tools in linux. Let's analyze a simple python script.

30 December 2019

Store e-mail locally, Ubuntu sendmail stub for Php

Consider a script that saves e-mail to a file. Sendmail stub, setup in Ubuntu.

26 June 2019

Ubuntu 18.04 initramfs error

Let's analyze one of the reasons for the initramfs error when starting Linux Ubuntu 18.04. Let's try a system restore. fsck exited with status code 4.

Categories

  • Unix OS
  • Php
  • MySQL
  • JavaScript
  • Package Managers
  • Docker
  • Seo

Latest comments

Добрый день, Сергей. Я на более новых версиях блют...
root-i
23.02.23
Пробовал на transmart колонке. Ничего из перечисле...
Сергей
20.02.23
HenryMit, может быть
root-i
07.02.23
Неофрейдизм — это… Определение, принципы, представ...
HenryMit
07.02.23

I share information in which I needed help and spent a lot of time figuring it out. If the information helped at least one person, then this site was not created in vain.

Thank you for the continuation of the site:
Contacts

Telegram Viber Mail

Search for articles

  • Sign in
  • Create Account

Powered by chmod -R