Andrew's picture

I see the Wordpress appliance includes Xcache. That's great, but I'm struggling to get it working.

From what I can gather, I need to enter a username and password in the xcache.ini file (in /etc/php5/conf.d folder), but I'm not sure where to get those details from.

Can anyone point me in the right direction please?

Jeremiah's picture

XCache should already be working.  Look for an XCache section in phpinfo to see if it is.  As long as xcache.size is not set to zero in /etc/php5/conf.d/xcache.ini then it should be working.

The username and password are used for "administration" but that administration is not actually required for xcache to work.  If you do want to install the administration part of xcache you can follow the instructions found here.

Andrew's picture

According to phpinfo, I have 16M available to xcache (so it should be working) but I keep getting server errors when I try to use it for opcode caching within the W3 Total Cache plugin.

Any idea why this might be or any suggestions for diagnosing the problem?

Jeremiah's picture

Sorry, but no I don't have any other ideas offhand.  Do the errors point to anything in particular?

Andrew's picture


...and found the following error:
PHP Fatal error:  xcache_clear_cache(): 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 /var/www/wp-content/plugins/w3-total-cache/lib/W3/Cache/Xcache.php on line 87, referer:
Seems I need to configure the xcache username and password, but I don't know what these are.
If it helps, line 87 of Xcache.php reads: xcache_clear_cache(XC_TYPE_VAR, 0);
Jeremiah's picture

It sounds like the wordpress plugin calls the xcache_clear_cache() function which is requiring the xcache admin username and password to be set.  Follow the instructions in section 1.2 Generating your auth password.  Basically you just need to encrypt your password and then put the username and password either in the /etc/php5/conf.d/xcache.ini or your php.ini file and restart apache.  I'm not sure but you may need to enter the username and password somewhere in the w3-total-cache plugin interface as well.

To encrypt your password you can create a temporary file on your webserver called test.php with the following contents.

echo md5("password");

Then from your webserver's command line just run the following command and you should see the encrypted form of your password which you'll put in either of the .ini files mentioned above.

php test.php

Nauseous's picture

echo -n "password-here" | md5sum


Much easier and safer

Andrew's picture


Thanks for the pointers Jeremiah, I now have xcache working. For others, here's what to do:
  1. Create a temporary file in /var/www called test.php with the following contents:
    <?php echo md5("password"); ?>
  2. Open a browser, navigate to test.php and copy the encrypted password that's displayed
  3. Edit /etc/php5/conf.d/xcache.ini as follows:
    xcache.admin.enable_auth = Off
    xcache.admin.user = "admin" (in my case at least)
    xcache.admin.pass = "abc123" (where "abc123" is the encryped password from step 2)
    xcache.var_size  = 16M (or whatever non-zero value you deem fit)
  4. Restart Apache
  5. Check all is well by browsing to your site and then examining the error.log file at /var/log/apache2

One thing I'm not sure about is how to change the username. I only discovered "admin" worked by trial and error, so I'm sure some extra guidance would be appreciated on that point.

Andrew's picture

Actually, I'm using APC instead now, but I'm glad my findings helped you.

L. Arnold's picture

A while back I tried switching Magento to APC from XCache but was not able to get it done..  There are some postings a while back on the subject.

What is the basic process from going from one to the other?

Are there any constraints in TKL that complicate this?

Andrew's picture

I don't know about Magento but, in WordPress at least, if APC is running on the server, then it should show up as an option in your caching plugin interface (e.g. in W3 Total Cache).

I don't think APC is included in the TKL appliance as standard, so you'd need to manually install it in a terminal session.

I'm not sure exactly how to do that as I've actually moved to an Nginx-based server that I had specially built for me (that includes APC).

If I were you, I'd probably just stick with XCache if it's working OK as, as far as I know, APC isn't significantly better.

But if you're looking to improve performance, moving to Nginx makes a huge difference.

Add new comment