* PHP: fix not starting Apache after adding apc.shm_size, caused by old APC version 3.1 (eg. in Debian6) using a shm_size in MB without unit

This commit is contained in:
Ralf Becker 2014-11-13 13:20:56 +00:00
parent f6ec2dc563
commit 24f8117c6b

View File

@ -866,8 +866,7 @@ function check_fix_php_apc_ini()
file_exists($path = $matches[1]) && ($apc_ini = file_get_contents($path))) file_exists($path = $matches[1]) && ($apc_ini = file_get_contents($path)))
{ {
$new_shm_size = 128 / $shm_segments; $new_shm_size = 128 / $shm_segments;
$new_shm_size .= 'M'; if (!$numeric_size) $new_shm_size .= 'M';
if ($numeric_size) $new_shm_size = _size_with_unit ($new_shm_size);
if (preg_match('|^apc.shm_size\s*=\s*(\d+[KMG]?)$|m', $apc_ini)) if (preg_match('|^apc.shm_size\s*=\s*(\d+[KMG]?)$|m', $apc_ini))
{ {
file_put_contents($path, preg_replace('|^apc.shm_size\s*=\s*(\d+[KMG]?)$|m', 'apc.shm_size='.$new_shm_size, $apc_ini)); file_put_contents($path, preg_replace('|^apc.shm_size\s*=\s*(\d+[KMG]?)$|m', 'apc.shm_size='.$new_shm_size, $apc_ini));