From 52d3aa70cdf7391c2194c5c17303738691cadfee Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Fri, 15 Jul 2016 13:23:08 +0200 Subject: [PATCH] enable APCu for caching with >= 32M and fix post_install to patch Ubuntu-16.04 /etc/php/7.0/cli/conf.d/20-apcu.ini --- api/src/Cache/Apcu.php | 9 +++++---- doc/rpm-build/post_install.php | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/api/src/Cache/Apcu.php b/api/src/Cache/Apcu.php index 610d091f5f..2d58bc3e5a 100644 --- a/api/src/Cache/Apcu.php +++ b/api/src/Cache/Apcu.php @@ -53,8 +53,9 @@ class Apcu extends Base implements Provider /** * Check if APC is available for caching user data * - * Default shared memory size of 32M is just enough for the byte code cache, - * but not for caching user data, we only use APC by default if we have at least 64M. + * Default shared memory size of 32M, which is used only for user data in APCu. + * Unlike APC which shares the total memory with it's opcode cache 32M is ok + * for a small install. * * @return boolean true: apc available, false: not */ @@ -75,8 +76,8 @@ class Apcu extends Base implements Provider } $size *= ini_get('apc.shm_segments'); - // only cache in APC, if we have at least 64M available (default is 32M) - $available = $size >= 67108864; + // only cache in APCu, if we have at least 32M available (default is 32M) + $available = $size >= 33554432; } //error_log(__METHOD__."() size=$size returning ".array2string($available)); return $available; diff --git a/doc/rpm-build/post_install.php b/doc/rpm-build/post_install.php index 728507a703..bc3ab665d9 100755 --- a/doc/rpm-build/post_install.php +++ b/doc/rpm-build/post_install.php @@ -724,7 +724,7 @@ function _ucr_secret($name) */ function check_fix_php_apc_ini() { - if (extension_loaded('apc')) + if (extension_loaded('apc') || extension_loaded('apcu')) { $shm_size = ini_get('apc.shm_size'); $shm_segments = ini_get('apc.shm_segments'); @@ -741,7 +741,7 @@ function check_fix_php_apc_ini() phpinfo(); $phpinfo = ob_get_clean(); $matches = null; - if (preg_match('#(/[a-z0-5./-]+apcu?.ini)(,| |$)#mi', $phpinfo, $matches) && + if (preg_match('#(/[a-z0-9./-]+apcu?.ini)(,| |$)#mi', $phpinfo, $matches) && file_exists($path = $matches[1]) && ($apc_ini = file_get_contents($path))) { $new_shm_size = 128 / $shm_segments;