LiteMage 2 troubleshooting for Magento 2

"Your installation of LiteSpeed Web Server does not have LiteMage Cache enabled"

You may see some message like the following: Your installation of LiteSpeed Web Server does not have LiteMage Cache enabled. Please make sure your LiteSpeed license includes the LiteMage cache module, and LiteMage is turned on in the .htaccess file in the root directory of your Magento installation.

It is pretty much self-explained. You need to check the license or .htaccess file “LiteMage On”.

"LiteMage Cache on LiteSpeed Web Server" Full Page Cache Option Not Appearing

There are a few known reasons for this problem:

  1. Your LiteSpeed license does not have the LiteMage module enabled. While all trial licenses include LiteMage unlimited, the LiteMage add-on must be added to new and existing licenses. Learn how to Add a Cache Module.
  2. Your Magento installation's .htaccess file does not contain the “LiteMage on” directive.
  3. If you are a shared hosting account user, you need to confirm with your host that if they have enabled LiteMage feature for your account.

Response Header Does Not Contain "X-LiteSpeed-Cache: hit,litemage"

Is Litemage included in your license?

Check the license to ensure that the LiteMage feature is inluded.

Is LiteMage on in .htaccess?

Check your .htaccess file to ensure you see LiteMage On.

Are you using a LiteSpeed web server?

Check the header to ensure litespeed web server is in use instead of another web server, such as Apache.

Is cache root set on the server and virtual host level?

Follow the appropriate section of the server-level and virtual-host-level cache-root setup wiki.

For example: On a cPanel EA4 environment, you can use the following to check:

grep -i -r lscache /etc/apache2/*

You should be able to see the following. If not, you will need to set them up.

/etc/apache2/conf.d/userdata/lscache_vhosts.conf:CacheRoot lscache
/etc/apache2/conf.d/includes/pre_main_global.conf:CacheRoot /home/lscache/

Page Cache should be enabled under Cache Management

In System > Cache Management, refresh the “Configuration” and “Page Cache” cache types. “Page Cache” should be enabled, if not, then LiteMage can not work and LiteMage Cache Management stats won't show up.

Page is not cachable because of "cacheable" is set to "false"

If you followed every step in the installation wiki and still do not see the X-LiteSpeed-Cache: hit,litemage header for that page/for all pages, it is likely that the page is non-cacheable due to a setting from another plugin.

You can verify this by switching the Magento 2 full page cache setting from LiteMage back to the built-in cache and testing the header again. Most likely you won't see a cache header there either.

To find the plugin that is causing the conflict, navigate to the /app/ and /vendor/ (user can install modules under either app or vendor, that depends on how user installs it. if using composer, it will be in vendor directries, so both /app/ and /vendor/ directories should be checked), and execute the following command:

grep -r cacheable * | grep xml | grep false

Your output might look something like the following:

code/Mageplaza/SocialLogin/view/frontend/layout/customer_account_create.xml:        <block  class="Mageplaza\SocialLogin\Block\Popup\Authentication\Social" before="-" name="social-login-popup-authentication-social-create" ifconfig="sociallogin/general/is_enabled" template="Mageplaza_SocialLogin::form/social.phtml" cacheable="false"/>
code/Mageplaza/SocialLogin/view/frontend/layout/customer_account_login.xml:        <block class="Mageplaza\SocialLogin\Block\Popup\Authentication\Social" after="" ifconfig="sociallogin/general/is_enabled" name="social-login-popup-authentication-social-login" template="Mageplaza_SocialLogin::form/social.phtml" cacheable="false"/>
code/Mageplaza/SocialLogin/view/frontend/layout/default.xml:                    <block class="Mageplaza\SocialLogin\Block\Popup\Authentication\Social" name="social-login-popup-authentication-social" as="" template="popup/form/authentication/social.phtml" cacheable="false"/>

Here, cacheable=“false” from default.xml will prevent Magento from caching no matter which caching method is selected. Any page containing this block will be non-cacheable. If you see that layout/default.xml contains cacheable=“false”, then all pages on your Magento site will be considered non-cacheable.

Note: If you installed any 3rd party modules in the vendor directory, make sure to perform the above command again for that directory as well.

To fix this problem, you must disable the associated plugin or remove cacheable=“false” from the default layout. Just be aware that cacheable was probably set to false for a reason, and this method may cause the associated plugin to stop functioning correctly.

What if ''cacheable="false"'' appears somewhere other than ''default.xml''?

default.xml controls every page, but other layout files (.xml files) may override it for different pages, such as your home page, catalog pages, or product pages. When you check the header, you will need to check all of them to find out which pages are cached, which pages are not.

For example, you may notice that the home page is not cached, but catalog and product pages are cached ok. In that case, you will need to look for the template which controls the home page, which is not default.xml.

grep -r cacheable * | grep xml | grep false
design/frontend/Smartwave/porto/Magento_Theme/layout/cms_index_index.xml:        <block class="Smartwave\Filterproducts\Block\Home\Recommend" name="recommend_product" template="Smartwave_Filterproducts::grid.phtml" cacheable="false">

In this case, cms_index_index.xml is the one which controls the home page and you will need to modify the Smartwave theme's cms_index_index.xml

Check the Facebook Plugin

The Facebook plugin is one of the common plugins to cause the Magento store to be uncacheable. You can check the /vendor/ or /app/ directory.

[root@Magento vendor]# grep -r 'cacheable="false"' * | grep xml | grep default
mgs/social/view/frontend/layout/default.xml: <block class="MGS\Social\Block\FacebookLikeBox" name="" after="-" template="MGS_Social::fb-page-plugin.phtml" cacheable="false"/>
mgs/social/view/frontend/layout/default.xml: <block class="Magento\Framework\View\Element\Template" name="" template="MGS_Social::scripts.phtml" cacheable="false"/>

Verify that Magento's built-in cache is working

LiteMage works similarly to Magento's built-in FPC cache. If you cannot see a LiteMage hit, you can verify if Magento's built-in FPC works. If FPC doesn't work either, then it is more likely that some plugins are making your Magento non-cachable, and it is not a LiteMage issue.

To verify Magento built-in FPC cache:

  • You will need to run in developer mode. You can modify the doc_root .htaccess by enabling(uncommenting) the following:
    SetEnv MAGE_MODE developer
  • In Magento Admin > Stores > Configuration > Advanced > Full Page Cache > Caching Application, select Built-in Cache.
  • Navigate to System > Cache Management and flush the Magento cache
  • Open the Chrome or Firefox development tool first, then visit your Store URL. You should see:
    X-Magento-Cache-Control: max-age=86400, public, s-maxage=86400
      X-Magento-Cache-Debug: MISS

  • Visit the URL again, you should see:
    X-Magento-Cache-Control: max-age=86400, public, s-maxage=86400
      X-Magento-Cache-Debug: HIT

If Magento FPC is working fine, you should see the above. However, if you could not see X-Magento-Cache-Debug: HIT, then there is something wrong with your Magento extension.

For example, if you always see X-Magento-Cache-Debug: MISS or X-Magento-Cache-Control: max-age=0, it means Magento's built-in cache cannot cache the page. If that's the case, LiteMage will have the same problem.

See cache-control and litespeed-tag headers but no miss or hit

When you check the header, you may see the following:


This header indicates that the license is ok and the LiteMage plugin has been enabled, but the cache module is not working.


If cache module is working and that page is cacheable, you will always see x-litespeed-cache header, either miss or hit. If you only see x-litespeed-cache-control header but not together with x-litespeed-cache:miss, that means cache module not working properly.

For example: The above x-litespeed-tag header should always show up together with x-litespeed-cache:miss header. If not, it means something wrong with the setup. The common reason is a cache root permission problem. If there is a cache root permission problem, it means the cache file cannot be written or generated correctly.

The x-litespeed-tag problem can also be caused by incorrect cache root setup, or a license restriction such as you might have with a starter plan. This can be easily viewed in Cache Management LiteMage statistics. If cached object is 0, then it means there is a cache storage issue.

On a cPanel shared hosting environment, virtual host cache root is normally set to /home/$USER/lscache and it should be owned by nobody:user instead of user:user. If somehow you manually created this directory with user:user ownership, or you manually changed it to user:user ownership, there will be a cache module write permission issue as described above. You may also encounter the issue with some old cache files.

To fix the problem, remove the /home/$USER/lscache folder completely and restart the web server. The cache root folder (normally /home/$USER/lscache) will be created with correct ownership and permissions automatically during the restart. After restart, you should see the x-litespeed-cache:hit,litemage header.

How to setup cache warm up for Magento 2 using LiteMage 2

Magento 2 warm up is not available yet. You could set public TTL to a longer time at this stage instead, for example 24 hrs, if applicable.

Case Studies

litespeed_wiki/cache/litemage2/troubleshooting.txt · Last modified: 2018/06/04 20:32 by Lisa Clarke