Skip to content
CWPControl Web PanelDocumentation
  1. Home
  2. Docs
  3. Admin Guide
  4. PHP Settings
  5. WordPress & LSAPI-Cache

WordPress & LSAPI-Cache

Updated

When an account runs on the cwpsapi (lsphp) handler it can also serve LSAPI-Cache — a built-in full-page cache. Cached pages are returned fully rendered without running PHP at all, which is the single biggest speed-up for WordPress and other PHP apps under load. In CWP’s benchmarks a warm cache serves pages in under 5 ms at many thousands of requests per second, versus tens of milliseconds and a fraction of that throughput for dynamic (uncached) requests.

Note: LSAPI-Cache needs the cwpsapi (lsphp) handler, which is a CWPpro feature in CWP 2.0 and later. See LSAPI PHP (lsphp / cwpsapi) to activate the handler first.

1. Turn on LSAPI-Cache for the account (admin)

In the admin panel open WebServers → cwpsapi (LSAPI PHP + Cache), tick cache for the account and click Enable. From the command line:

/scripts/cwp_cwpsapi enable <account> --cache

2. Clear the cache from the user panel

The account owner has a LSAPI-Cache page in the user panel. It shows whether the handler is active and whether the full-page cache is on, with a Clear cache now button. Clearing the cache is safe at any time — the next visitors simply get freshly generated pages. Use it when a published change is not showing yet.

Note: If the page says the handler is active but the cache is off, the admin has not enabled LSAPI-Cache for that account (step 1), or the site should drive the cache through the WordPress plugin below.

3. WordPress: automatic cache purging

For WordPress, CWP sets up a compatible full-page-cache plugin automatically when the account is on cwpsapi, so the right pages are purged automatically whenever a post or page is published or edited — no manual clearing needed. The plugin also adds site-level optimizations (object cache, CSS/JS minify, image optimization, lazy-load).

  1. Confirm the account is on cwpsapi with LSAPI-Cache enabled (step 1).
  2. In wp-admin open the cache plugin’s settings and make sure Enable Cache is on.
  3. Publish or edit a post — the affected pages are purged for you.

Tip: With the plugin handling purges you rarely need the user-panel Clear cache button; keep it for the occasional manual flush (for example after a theme or config change made outside WordPress).

Common problems

SymptomCause / fix
User panel says LSAPI-Cache is not availableThe account is not on the cwpsapi handler. Enable it (see LSAPI PHP).
Every request is a cache MISS (never cached)On a Secure Kernel server, make sure the rules allow the cwpsapi cache path — run /scripts/cwpsecure_update_rules. Otherwise confirm the cache is on with /scripts/cwp_cwpsapi status <account>.
Edits do not show until I clear the cacheMake sure the WordPress cache plugin is active so purges happen automatically on every edit.