APCu Object Cache for PHP7 on WordPress on Ubuntu 16.04

Автор:human

APCu Object Cache for PHP7 on WordPress on Ubuntu 16.04

WordPress object cache is a common way to speed up your site. PHP-APCu on Ubuntu 16.04 can help achieve your goal of supreme WordPress or WooCommerce speed.

This guide will show you how to install APCu Object Cache for PHP7 for WordPress on Ubuntu 16.04. There are three installation methods outlined here to best suit your needs. Usually installing from the repository or using PEAR is recommended, for bleeding edge users installing APCu from source it shown as well.

Install APCu Object Cache for PHP7 on WordPress on Ubuntu 16.04

Here are 3 ways to install the APCu object cache for WordPress or WooCommerce.

You should only choose one installation method.

  • Install APCu object cache for WordPress with one of the following methods
    • Install using repository
    • Install using PHP Pear
    • Build PHP-APCu from source
  • Then install the APCu WordPress object cache plugin

Install APCu Object Cache via Repository

Using this method you will not always get the latest version, it is however the easiest method.

Restart your php7.0-fpm service if you are using nginx

Reload Apache if you are using it.

Install APCu Using php PEAR

Another way to install is using php-pear, install it first

Running this command will install APCu.

Add the extension to a custom ini file.

Since I use php7.0-fpm with nginx I am symlinking into the php7.0 fpm and cli folders.

Restart php7-fpm

Apache2 users will want to symlink this file

Apache users reload the Apache service

Install APCu from Source Manually

The last way to install php7-apcu is to build from source. This way you get the bleeding edge version.

We need to install the php 7 development package and git first.

Enter your /tmp folder and clone the latest APCu source code from the git repository.

Now build the php7.0-apcu extension and install it.

Add the extension to the apcu.ini file

Since I use php7.0-fpm with nginx I am symlinking into the php-7.0 fpm and cli folders.

Restart php7.0-fpm service

Apache2 users will want to symlink this file

Reload the Apache service

Install the APCu object cache plugin

We are going to install the LCache Plugin hosted on github sponsored by Pantheon.

If you do not have WP-CLI or shell access to your host then you have to create the object-cache.php file manually with these instructions.

You will see this output

Now you can optionally adjust the RAM for APCu and monitor the APCu cache

Adjust PHP-APCu RAM

Open the apcu.ini configuration file

Add the apc.shm_size line after the extension line. Here the APCu allocated ram is being changed to 50 MB.

Ctrl+X, Y and Enter to Save

Restart php7-fpm if ou are using it

Reload Apache if that is your web server of choice

Monitoring APCu Cache

Download the apc.php script

Now you can open yourdomain.com/apc.php and see the amount of cached objects, hit and miss rate.

php7-apcu-monitoring-wordpress-object-cache

Об авторе

human administrator

    Оставить ответ

    Войти с помощью: 

     

    Яндекс.Метрика