Simple Machines Community Forum

SMF Development => Bug Reports => Fixed or Bogus Bugs => Topic started by: Bigguy on October 15, 2012, 12:22:25 AM

Title: SMF 2.1 Bug: Xcache
Post by: Bigguy on October 15, 2012, 12:22:25 AM
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.

Title: Re: SMF 2.1 Bug: Xcache
Post by: Spuds on October 15, 2012, 09:46:44 AM
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 ...
Title: Re: SMF 2.1 Bug: Xcache
Post by: Bigguy on October 15, 2012, 09:56:32 AM
I don't have access to that file. My partner does and can make changes to it if need be.
Title: Re: SMF 2.1 Bug: Xcache
Post by: Spuds on October 15, 2012, 01:35:28 PM
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.
Title: Re: SMF 2.1 Bug: Xcache
Post by: Bigguy on October 15, 2012, 02:33:31 PM
Will test this as soon as I can and get back to you.
Title: Re: SMF 2.1 Bug: Xcache
Post by: Bigguy on October 16, 2012, 07:38:28 PM
Spuds, that did it. Works like a charm. Thank you. :)
Title: Re: SMF 2.1 Bug: Xcache
Post by: Spuds on October 16, 2012, 10:49:25 PM
Cool ... thanks for letting me know .... now I'll work on the "official" fix  :)
Title: Re: SMF 2.1 Bug: Xcache
Post by: Arantor on December 20, 2013, 06:40:27 PM
Sounds to me like a misconfiguration issue, not a problem with SMF itself. Moving to fixed.