← CodeClarityLab Home
Browse by Category
+ added · updated 7d
← Back to glossary

Test Environment Parity

testing Intermediate

Also Known As

dev prod parity environment consistency Docker dev environment 12-factor Factor VI

TL;DR

Dev, staging, and production must use identical PHP versions, MySQL versions, and OS configurations — divergence causes bugs that only appear in production.

Explanation

Environment parity (12-Factor App Factor VI): dev, CI, staging, and production use identical PHP version, extensions, database version and configuration, OS, timezone, and locale. Docker Compose committed to the repository ensures all developers use the same stack. PHP version matrix in CI tests against all supported versions. Common divergences that cause bugs: PHP 7.4 vs 8.3 behaviour differences, MySQL strict mode enabled in production but not dev, different timezone configurations.

Common Misconception

Staging environment parity is sufficient — the highest-value parity is between development and production; developer environment divergence from production causes the most bugs and is the most common source of 'works on my machine'.

Why It Matters

A bug that only appears in production because the developer runs PHP 8.1 while production runs 8.3 costs far more to find and fix than the effort of running identical versions in Docker Compose.

Common Mistakes

  • System PHP on developer machines diverging from production version
  • No committed docker-compose.yml — each developer's environment drifts over time
  • Different MySQL strict mode between environments — queries accepted in dev rejected in production
  • Wrong timezone in dev or CI — date calculation bugs that only appear in certain timezones

Code Examples

✗ Vulnerable
# Divergent environments — bugs appear only in production:
# Developer: PHP 8.1 (system PHP), MySQL 5.7, UTC timezone
# CI: PHP 8.2 (GitHub Actions default), MySQL 8.0, UTC
# Production: PHP 8.3, MySQL 8.0, Europe/London timezone
# Bug: MySQL 8.0 strict mode rejects query that 5.7 accepts
# Discovered: production deployment — emergency hotfix
✓ Fixed
# docker-compose.yml committed — identical for all developers:
services:
  php:
    image: php:8.3-fpm-alpine  # Same as production
    environment:
      APP_TIMEZONE: Europe/London  # Match production
  mysql:
    image: mysql:8.0  # Same version as production
    environment:
      MYSQL_STRICT_MODE: '1'  # Match production strict mode

# CI also uses mysql:8.0 and PHP 8.3 — identical stack

Added 16 Mar 2026
Edited 22 Mar 2026
Views 22
Rate this term
No ratings yet
🤖 AI Guestbook educational data only
| |
Last 30 days
1 ping W 1 ping T 2 pings F 0 pings S 0 pings S 2 pings M 0 pings T 0 pings W 0 pings T 1 ping F 0 pings S 0 pings S 0 pings M 0 pings T 0 pings W 0 pings T 2 pings F 0 pings S 0 pings S 0 pings M 0 pings T 0 pings W 0 pings T 1 ping F 0 pings S 0 pings S 1 ping M 0 pings T 0 pings W 0 pings T
No pings yet today
No pings yesterday
Amazonbot 8 Perplexity 4 Unknown AI 2 Ahrefs 2 Google 1
crawler 17
DEV INTEL Tools & Severity
🟠 High ⚙ Fix effort: Medium
⚡ Quick Fix
Run your test suite inside the same Docker image used for production — differences between test and production environments are the #1 cause of 'works on my machine' bugs
📦 Applies To
any web cli
🔗 Prerequisites
🔍 Detection Hints
Tests running on PHP 8.1 while production is 8.3; MySQL version differences between dev and prod; different extension configurations
Auto-detectable: ✗ No docker github-actions docker-compose
⚠ Related Problems
🤖 AI Agent
Confidence: Medium False Positives: Medium ✗ Manual fix Fix: High Context: File Tests: Update

✓ schema.org compliant