Lesson 6 of 8
Production Readiness Checklist
Before taking any application to production, verify every layer - security, performance, error handling, monitoring, and backup. This checklist covers everything you've learned across all 12 modules, giving you a complete production launch reference.
Complete PHP Production Readiness Checklist
# ✅ PHP Production Readiness Checklist
# (Cross-references the module where each topic was covered)
# ── SECURITY ──────────────────────────────────────────────────
# [Module 7]
# □ All SQL queries use prepared statements (no string concatenation)
# □ All output HTML-encoded with htmlspecialchars(ENT_QUOTES, 'UTF-8')
# □ CSRF token on every state-changing form
# □ Passwords hashed with password_hash(PASSWORD_BCRYPT, cost>=12)
# □ .env not accessible from web (stored ABOVE document root)
# □ Security headers sent: CSP, HSTS, X-Frame-Options, nosniff
# □ Sessions: httponly, secure, samesite=strict
# □ File uploads: MIME type verified, stored outside webroot
# □ No eval(), no unserialize() on user input
# □ Rate limiting on all auth endpoints (login, password reset)
# ── ERROR HANDLING ─────────────────────────────────────────────
# [Module 7, Module 10]
# □ display_errors = Off (php.ini or ini_set in bootstrap)
# □ log_errors = On (errors written to log file)
# □ set_exception_handler() configured - shows generic message to users
# □ register_shutdown_function() for fatal errors
# □ Custom 404 and 500 error pages (not PHP's default)
# □ No stack traces visible to users in production
# ── PERFORMANCE ───────────────────────────────────────────────
# [Module 11]
# □ Opcache enabled: opcache.enable=1
# □ opcache.validate_timestamps=0 in production
# □ Deployment script calls opcache_reset() or reloads PHP-FPM
# □ Composer autoloader optimised: --optimize-autoloader
# □ Cache in place for expensive queries (Posts feed, tag lists)
# □ Database indexes on WHERE/ORDER BY/JOIN columns (EXPLAIN verified)
# □ Static assets served directly by Nginx (not PHP)
# □ Gzip compression enabled (Nginx gzip on)
# ── LOGGING & MONITORING ──────────────────────────────────────
# [Module 10]
# □ Structured logging with context (user_id, request_id)
# □ Log rotation configured (logrotate or RotatingFileHandler)
# □ Error alerting (Sentry, Bugsnag, or email on CRITICAL)
# □ Server metrics monitored (CPU, RAM, disk - Netdata, Prometheus)
# □ Slow query log enabled in MySQL
# ── DEPLOYMENT ────────────────────────────────────────────────
# [Module 12]
# □ Atomic symlink deployment (zero-downtime)
# □ composer install --no-dev --optimize-autoloader on deploy
# □ Database migrations run before traffic switch
# □ Rollback plan (previous release kept)
# □ SSL certificate in place and auto-renewing (Certbot)
# □ Firewall allowing only 80, 443, 22 (SSH)
# □ Non-root user running PHP-FPM and web server
# □ Database backups automated and tested
# ── CODE QUALITY ──────────────────────────────────────────────
# [Module 11]
# □ PHPStan analysis at level 8 passes with zero errors
# □ PSR-12 formatting passes phpcs
# □ PHPUnit test suite passes (unit + integration tests)
# □ CI pipeline runs quality checks on every PR
# □ No TODO/FIXME left in production code paths
# ── NGINX specific ────────────────────────────────────────────
# [Module 12]
# □ client_max_body_size matches PHP upload_max_filesize
# □ Hidden files blocked (location ~ /. { deny all; })
# □ .env, .git directories inaccessible from web
# □ PHP-FPM connected via Unix socket (not TCP - faster)
# □ pm.max_children sized for available RAM
# (Rule of thumb: RAM_MB / 40 = max PHP workers)Quick Quiz
Tip
Tip
Practice Production Readiness Checklist in small, isolated examples before integrating into larger projects. Breaking concepts into small experiments builds genuine understanding faster than reading alone.
Visual architecture and concepts for Production Readiness Checklist
Practice Task
Note
Practice Task - (1) Write a working example of Production Readiness Checklist from scratch without looking at notes. (2) Modify it to handle an edge case (empty input, null value, or error state). (3) Share your solution in the Priygop community for feedback.
Common Mistake
Warning
A common mistake with Production Readiness Checklist is skipping edge case testing - empty inputs, null values, and unexpected data types. Always validate boundary conditions to write robust, production-ready php code.