Memcached installation


#1

Following instructions found here: https://www.computersnyou.com/5828/

I’ve got it running, but it will not stay running.

The daemon - opening an ssh shell on a site…
apt-get update
apt-get install memcached
service memcached start

Now for installing php 7 memcached extension

apt-get install build-essential pkg-config git autoconf
apt-get install libmemcached-dev libmsgpack-dev libmsgpackc2

cd /conf/php/7.1.4
git clone --depth 1 https://github.com/php-memcached-dev/php-memcached.git
cd php-memcached
/opt/php/7.1.4/bin/phpize
./configure --with-php-config=/opt/php/7.1.4/bin/php-config
make install
make test

memcachetest.php
<?php
error_reporting(E_ALL & ~E_NOTICE);

$mc = new Memcached(); 
$mc->addServer("localhost", 11211); 

$mc->set("foo", "Hello!"); 
$mc->set("bar", "Memcached..."); 

$arr = array( 
    $mc->get("foo"), 
    $mc->get("bar") 
); 
var_dump($arr); 
?> 

pop it in php.ini (the /opt/ directory didnt work for me)

[memcached]
extension = /conf/php/7.1.4/php-memcached/modules/memcached.so

restart the site

and

restart

service memcached start


#2

and to start memcached on restarting site…

add

service memcached start

to

/etc/scripts/startup.sh