Skip to content

Getting a 95+ Lighthouse score on a real PHP website

Technology Nexora Technologies 10 Apr 2026 3 min read 0 views

Performance scores on a blank template are easy. Here is what it takes on a production site with a database, images, a content management system and real marketing requirements.

Any developer can score 100 on Lighthouse with an empty page. The interesting problem is scoring above 95 on a real corporate site: database-driven content, a media library, tracking scripts marketing insists on, and a client who will upload a 4 MB photograph the week after launch.

Start with the images, because it is always the images

On almost every site we audit, images account for the majority of the payload. The fixes are unglamorous and effective.

  • Resize on upload rather than in CSS. An image displayed at 640px should not be stored at 4000px.
  • Recompress server-side. Quality 82 on JPEG is visually indistinguishable from 100 at roughly a third of the size.
  • Set explicit width and height attributes so the browser reserves layout space and avoids cumulative layout shift.
  • Lazy-load everything below the fold, eagerly load the hero image.

Doing this at upload time rather than asking content editors to remember is the only approach that survives contact with a real marketing team.

Fonts cost more than people expect

Two font families at three weights each is six files, and each one blocks text rendering. Use display=swap, preconnect to the font origin, and be ruthless about weights. Most sites need two.

Render-blocking resources

Bootstrap from a CDN is convenient but adds a DNS lookup, a connection and a round trip before your CSS applies. Preconnect helps. Critical CSS inlined in the head helps more. For most corporate sites, the pragmatic answer is a CDN with preconnect plus a small inlined block covering above-the-fold layout.

Database queries are a performance problem, not just a scaling one

A page issuing forty queries is slow before it is popular. Two patterns fix most of it:

  • Load settings once per request and cache them in a static property rather than querying per call.
  • Join rather than looping. A list of twelve portfolio items with categories should be one query, not thirteen.

Server configuration

Gzip or Brotli compression, far-future cache headers on static assets, and HTTP/2 are configuration rather than code. On shared hosting these live in .htaccess and take fifteen minutes to get right.

What to measure

Lighthouse in a lab is a proxy. Core Web Vitals from real users are the truth. Largest Contentful Paint under 2.5 seconds, Interaction to Next Paint under 200 milliseconds, and Cumulative Layout Shift under 0.1 are the targets that matter, measured on the devices and connections your visitors actually have.

The honest caveat

A 95 score does not guarantee a fast experience, and a 92 is not a failure. Chasing the last few points frequently costs more than it returns. Fix the images, fix the queries, configure the server, and spend the remaining time on something a visitor will notice.

Share:

Related reading