Skip to main content

Installing APCu in PHP 7


APCu is one of caching application for PHP. In this case, I use PHP 7.0 on Ubuntu 16.04. In PHP 7.0, this application is provided via PEAR.

First, install PEAR.

$ sudo apt-get install php-pear

Install APCu. If an error occured state that there's no phpize, you need to install PHP 7.0-dev which provide phpize support.

$ sudo apt-get install php7.0-dev
$ sudo pecl install apcu

Create APCu module configuration in PHP modules directory.

$ sudo echo "extension = apcu.so" >> /etc/php/7.0/mods-available/apcu.ini

Add that configuration to PHP FPM and CLI.

$ sudo ln -s /etc/php/7.0/mods-available/apcu.ini /etc/php/7.0/fpm/conf.d/30-apcu.ini
$ sudo ln -s /etc/php/7.0/mods-available/apcu.ini /etc/php/7.0/cli/conf.d/30-apcu.ini

Restart PHP FPM.


Comments