diff --git a/framework/caching/FileCache.php b/framework/caching/FileCache.php index 919a05a5893..08f292084e9 100644 --- a/framework/caching/FileCache.php +++ b/framework/caching/FileCache.php @@ -144,7 +144,7 @@ protected function setValue($key, $value, $duration) // If ownership differs the touch call will fail, so we try to // rebuild the file from scratch by deleting it first // https://github.com/yiisoft/yii2/pull/16120 - if (is_file($cacheFile) && fileowner($cacheFile) !== posix_geteuid()) { + if (is_file($cacheFile) && function_exists('posix_geteuid') && fileowner($cacheFile) !== posix_geteuid()) { @unlink($cacheFile); } if (@file_put_contents($cacheFile, $value, LOCK_EX) !== false) {