Test Environment Parity
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
References
Tags
🤝 Adopt this term
£79/year · your link shown here
Added
16 Mar 2026
Edited
22 Mar 2026
Views
22
🤖 AI Guestbook educational data only
|
|
Last 30 days
Agents 0
No pings yet today
No pings yesterday
Amazonbot 8
Perplexity 4
Unknown AI 2
Ahrefs 2
Google 1
Also referenced
How they use it
crawler 17
Related categories
⚡
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