Ubuntu 16.04 Adding memcached and redis extended PHP7

Switch to PHP 7 after that,Site speed boost,But usually just one of extension may not yet support PHP7.

Memcached

For example, I now use the latest Ubuntu 16.04,Although it built in PHP 7 source,But it has not memcached,Fortunately, however,,It has supported PHP 7 ,Not just the source of it,We compile it manually。

To install memcached,You need to install the dependent libraries libmemcached

FromHereFind the latest source package libmemcached,Then download。

After installing dependent libraries,We install memcached :

From github clone memcached,You need to switch manually to the branch php7,Or you will be prompted fatal error: ext/standard/php_smart_str.h: No such file or directory error。

Redis

Same,Redis actually have PHP 7 version,We get cloned from github project,Then you can manually switch to php7 branch:

Start Expansion

Installation of light is not enough,We also need to edit the configuration file to enable PHP extensions to be loaded for the job, we /etc/php/7.0/fpm/php.this ,Add the following statement in the configuration file:

Finally, use the command to restart the service PHP: service php7.0-fpm restart

WordPress

For WordPress is,Here we need to download a separate plug-in:https://github.com/tollmanz/wordpress-pecl-memcached-object-cache

Since the official plugin wp caching plugin library only supports memcache,We can only own download object-cache.php Files to your blog wp-content The directory。

If one day you no longer want to use memcached,Put the file deletion。

Other,If you ran more than a WordPress vps ,So, if you want to give them all caching enabled,You have to edit wp-config.php file,turn up define('WP_DEBUG', false); This line,In its lower starting a new line and enter the following:

Such,Every WordPress program can access it alone memcached Caching。

Other,If you are using WP Super Cache Caching plugin,At this time you should be able to go to its advanced settings to find the support options for memcached:)

Published by R0uter

The non-declaration,I have written articles are original,Reproduced, please indicate the link on this page and my name。

Leave a comment

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