if ($cacheInfo['type'] == XC_TYPE_VAR && $cacheInfo['cached']) {
$varCached += $cacheInfo['cached'];
}
if ($cacheInfo['can_readonly']) {
$readonlyProtection = true;
}
}
if ($errors) {
note(
}
// }}}
checking(_T("Enabling PHP Cacher")); // {{{
if (!$xcacheLoaded) {
result("skipped", "XCache not loaded");
}
else if (!ini_get("xcache.size")) {
result(
"error"
, _T("Not enabled: Website is not accelerated by XCache")
, _T("Set xcache.size to non-zero, set xcache.cacher = On")
);
}
else if (!$phpCached) {
result(
"error"
, _T("No php script cached: Website is not accelerated by XCache")
, _T("Set xcache.cacher = On")
);
}
else {
result("info", _T('Enabled'));
}
// }}}
checking(_T("PHP Compile Time Error")); // {{{
if (!$xcacheLoaded) {
result("skipped", "XCache not loaded");
}
else if (!$phpCacheCount) {
result("skipped", "XCache PHP cacher not enabled");
}
else if ($errors) {
result(
"warning"
, _T("Error happened when compiling at least one of your PHP code")
, _T("This usually means there is syntax error in your PHP code. Enable PHP error_log to see what parser error is it, fix your code")
);
}
else {
result("info", _T('No error happened'));
}
// }}}
checking(_T("Busy Compiling")); // {{{
if (!$xcacheLoaded) {
result("skipped", "XCache not loaded");
}
else if (!$phpCacheCount) {
result("skipped", "XCache PHP cacher not enabled");
}
else if ($compiling) {
result(
"warning"
, _T("Cache marked as busy for compiling")
, _T("It's ok if this status don't stay for long. Otherwise, it could be a sign of PHP crash/coredump, report to XCache devs")
);
}
else {
result("info", _T('Idle'));
}
// }}}
checking(_T("Enabling VAR Cacher")); // {{{
if (!$xcacheLoaded) {
result("skipped", "XCache not loaded");
}
else if (!ini_get("xcache.var_size")) {
result(
"error"
, _T("Not enabled: code that use xcache var cacher fall back to other backend")
, _T("Set xcache.var_size to non-zero")
);
}
else {
result("info", _T('Enabled'));
checking(_T("Using VAR Cacher")); // {{{
if ($varCached) {
result(
"warning"
, _T("Error happened when compiling at least one of your PHP code")
, _T("This usually means there is syntax error in your PHP code. Enable PHP error_log to see what parser error is it, fix your code")
, _T("No variable data cached")
, _T("Var Cacher won't work simply by enabling it."
. " PHP code must call XCache APIs like xcache_set() to use it as cache backend. 3rd party web apps may come with XCache support, config it to use XCache as cachign backend")
);
}
else {
note("info", _T('All PHP scripts seem fine'));
result("info", _T('Cache in use'));
}
/*
if ($ini['xcache.count'] <cpucount()*2){
// }}}
}
// }}}
checking(_T("Cache Size")); // {{{
if (!$xcacheLoaded) {
result("skipped", "XCache not loaded");
}
else if ($ooms) {
result(
"warning"
, _T("Out of memory happened when trying to write to cache")
, sprintf(_T("So many item are cached. Increase %s to a more proper value"), "xcache.{$prefix}slots")
);
}
else {
result("info", _T('Looks good'));
}
// }}}
checking(_T("Cache Status")); // {{{
if (!$xcacheLoaded) {
result("skipped", "XCache not loaded");
}
else if ($disabled) {
result(
"warning"
, _T("At least one of the caches is disabled. ")
. (ini_get("xcache.crash_on_coredump") ? _T("It was disabled by PHP crash/coredump handler or You disabled it manually") : _T('You disabled it manually'))
, _T("Enable the cache.")
. (ini_get("xcache.crash_on_coredump") ? " " . _T("If it was caused by PHP crash/coredump, report to XCache devs") : "")
);
}
else {
result("info", _T('Idle'));
}
// }}}
if ($ini['xcache.readonly_protection']) {
checking(_T("Coredump Directory")); // {{{
if (!$xcacheLoaded) {
result("skipped", "XCache not loaded");
}
else if (!ini_get("xcache.coredump_directory")) {
result("info"
, _T("Not enabled")
, _T("Enable coredump to know your PHP crash. It can also be enabled in fpm other than in XCache")
);
}
else if (ini_get("xcache.coredump_directory")) {
$coreDir = ini_get("xcache.coredump_directory");
if (substr($coreDir, -1) != DIRECTORY_SEPARATOR) {
, _T("Disable XCache PHP Cacher (xcache.size=0), remove the core file(s). If core file appears again, report call stack backtrace in the core to XCache devs")
);
}
if ($cache['compiling']) {
else {
result("info"
, _T("Enabled")
, sprintf(_T("You can see core files if PHP crash in %s if PHP crash"), ini_get("xcache.coredump_directory"))
);
}
if ($cache['disabled']) {
}
// }}}
checking(_T("Readonly Protection")); // {{{
if (!$xcacheLoaded) {
result("skipped", "XCache not loaded");
}
else if (ini_get("xcache.readonly_protection") && !$readonly_protection) {
if (array_search("Zend Optimizer", $loadedZendExtensions) !== false) {
result(
"warning"
, _T("Zend Optimizer loaded")
, _T("Optimizer feature of 'Zend Optimizer' is disabled by XCache due to compatibility reason; the Loader of it is still available, encoded files are still supported")