SMF 2.1 Bug: Xcache

Started by Bigguy, October 15, 2012, 12:22:25 AM

Previous topic - Next topic

Bigguy

When I have the Caching settings set to level 1 and SMF has detected XCache as the accelerator all is fine. Until you go to clear your cache. Then you get an error like this:

Fatal error:  xcache_clear_cache() [<a href='http://xcache.lighttpd.net/wiki/InstallAdministration'>http://xcache.lighttpd.net/wiki/InstallAdministration</a>]: xcache.admin.user and/or xcache.admin.pass settings is not configured. Make sure you've modified the correct php ini file for your php used in webserver. in /home/******/public_html/21/Sources/Subs.php on line 3685


Clearing the cache works fine if you have the caching settings set to SMF file based caching. This problem does not exist in 2.0.2. If this has been solved or already discussed please disregard this.


Spuds

Do you have access to the xcache.ini file?

The 2.0x cache clear function only cleared the file cache it did not clear or attempt to clear xcache, apc, eacc, etc ...

Bigguy

I don't have access to that file. My partner does and can make changes to it if need be.

Spuds

Looks like some of the Xcache functions are considered Admin level and are protected if you have xcache.admin.enable_auth = On in the xcache.ini or phi.ini depending on how you have the server setup.

Anyway I've attached some test code for, well testing  :)  In subs.php find the section that starts with case 'xcache' and ends in break; and replace it with the code below.  This worked on my test system but that does not necessary mean a darn thing!

case 'xcache':
if (function_exists('xcache_clear_cache') && function_exists('xcache_count'))
{
$_SERVER["PHP_AUTH_USER"] = 'userid';
$_SERVER["PHP_AUTH_PW"] = 'password'; /* not the md5 one in the .ini but the real password */

// Get the counts so we clear each instance
$pcnt = xcache_count(XC_TYPE_PHP);
$vcnt = xcache_count(XC_TYPE_VAR);

// Time to clear the user vars and/or the opcache
if ($type === '' || $type === 'user')
{
for ($i = 0; $i < $vcnt; $i++)
xcache_clear_cache(XC_TYPE_VAR, $i);
}

if ($type === '' || $type === 'data')
{
for ($i = 0; $i < $pcnt; $i++)
xcache_clear_cache(XC_TYPE_PHP, $i);
}
}
break;


In that block of code you will need to enter the userid and the password that provides admin access to xcache functions.  Note the password needs to be the real (clear text) password and not the md5 on that you will find in the xcache.ini file.

If this works I'll add a area to the cache enable so you can (optionally) enter the credentials there so the clear cache works.

Bigguy

Will test this as soon as I can and get back to you.

Bigguy

Spuds, that did it. Works like a charm. Thank you. :)

Spuds

Cool ... thanks for letting me know .... now I'll work on the "official" fix  :)

Arantor

Sounds to me like a misconfiguration issue, not a problem with SMF itself. Moving to fixed.

Advertisement: