Skip to content

Instantly share code, notes, and snippets.

@ejlp12
Last active May 26, 2024 00:37
Show Gist options
  • Save ejlp12/26b48c8847010495668c702f029f8398 to your computer and use it in GitHub Desktop.
Save ejlp12/26b48c8847010495668c702f029f8398 to your computer and use it in GitHub Desktop.
codeigniter 3 cache using PHP APMu

Tested on php-fpm 7.2

APCu installation

sudo apt-get install php7.2-dev php7.2-xml php-pear php-xml

sudo pecl -d php_suffix=7.2 install apcu
echo "extension=apcu.so" | sudo tee  /etc/php/7.2/mods-available/apcu.ini
echo "apc.enabled=1" | sudo tee -a /etc/php/7.2/fpm/php.ini

sudo systemctl status php7.2-fpm.service

check your phpinfo() to make sure apcu extention is active

Edit system/libraries/Cache/drivers/Cache_apc.php

  1. Find the following line:
return (extension_loaded('apc') && ini_get('apc.enabled'));

change to:

return (extension_loaded('apcu') && ini_get('apc.enabled'));
  1. Change all function calls started with apc_ to apcu_
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment