Caching Pages That Depend on PHP Session

If you have pages that depend on the PHP Session, you will find that they don't work properly with LiteSpeed Cache.

Some plugins such as WHMpress that use PHP session to store values (currency, language…etc) don't work with LiteSpeed Cache.

Once LiteSpeed Cache is enabled, user dependant values like currency do not work or display correctly.

Pages whose content depends on PHP session are not cache-friendly. Once the cached page is generated, it will not vary on session data.

Why? LiteSpeed Cache is designed to avoid hitting the PHP backend. Therefore, there is no way for the cache module to know what value is stored in PHP session for any visitor other than the first one to load the page.

To make this to work, a code change to the third party plugin is required. The developer can change the plugin to store the value in a cookie and then LiteSpeed Cache can be set to vary on that cookie.

  • Admin
  • Last modified: 2018/06/25 15:22
  • by Lisa Clarke