GIT –  is a system daemon that allows you to information on RAM memory, this allows you better app speeds and avoid bad performance on your dedicated or vps . Memcached works at system level, however you can use Memcached with many programming languages in order to optimize your apps. On this example I will show you how to memcached on with the -memcache extension.

Memcached Pre requisites

Ensure all packages are up to date

sudo apt-get update

Installing PHP basic modules, along with compilers

sudo apt-get install mysql-server php5-mysql php5 php5-memcache build-essential

Install Memcached

sudo apt-get install memcached

Installing php-pear (this is where we will get memcache module)

sudo apt-get install php-pear

Install memcache php extension using PECL

sudo pecl install memcache

If the PECL installation asks this question:

"Enable memcache session handler support? [yes]"

Just type enter in order to continue without issues.

Last step: add your new memcache.so module to PHP memcache.ini file:

touch /etc/php5/conf.d/memcache.ini
echo "extension=memcache.so" >> /etc/php5/conf.d/memcache.ini

Start memcached

sudo service memcached start

Reload your PHP server to load the memcached extension

If you use php-fpm:

sudo service php5-fpm reload

If you use Apache:

sudo service apache2 reload

Test memcached

ps aux | grep memcache

You should see something like this:

memcache 14289 0.0 0.0 38358 1172 ? Sl 06:15 0:00 /usr/bin/memcached -m 64 -p 11211 -u memcache -l 127.0.0.1

Remember to configure memcached at system level from:

/etc/memcached.conf
Print Friendly

Comments

comments

Bài viết liên quan