A well-written PHP site is fast out of the box. These steps keep it fast as the site grows.

Turn on OPcache

OPcache keeps compiled PHP scripts in memory, so files are not recompiled on every request. On a production server this is usually the easiest change with the biggest impact.

Compress and cache assets

Turn on gzip or Brotli compression for HTML, CSS, and JavaScript. Give static assets a long Cache-Control header, and add a version number to file addresses so visitors still get updates.

Shrink and defer images

Images are often the largest part of a page. Serve sizes that match how they are displayed, set width and height so the layout does not shift, and use lazy loading for images below the first screen. Do not defer the main image at the top of the page.

Load fonts carefully

Host your fonts yourself, use the woff2 format, and load only the subsets you need. Set font-display swap so text stays readable while fonts load.

Cut down queries and repeated work

Avoid queries inside loops. Fetch the data you need in one query, and cache results that are expensive but rarely change, with a clear expiry time.

Measure before and after

Use Lighthouse and the Core Web Vitals report in Search Console. Note your numbers before each change so you know which steps make a difference. Page speed also shapes the visitor experience in an online store as much as on a profile site.