Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Browse all series

Debugging Real-World Production Nightmares

Production bugs don't announce themselves politely. In this series, we confront ten nightmare scenarios using NightmareMart, an intentionally broken e-commerce app, demonstrating how to debug calmly and methodically when everything is on fire.

Progress

Series Info

Episodes
10
Run Time
1h 49m
Difficulty
Advanced
Last Updated
Feb 11, 2026
Version
Latest

Series Episodes

  1. Episodes (10)
    1. The "Works on My Machine" Disaster

      Checkout throws 500 errors in production but works perfectly locally. We'll trace the issue to improper env() usage with config caching and learn why environment differences kill deployments.
    2. Death By N+1 Queries

      The admin orders page gets slower until it times out. We'll use Debugbar to expose hidden N+1 queries in Blade templates and fix them with strategic eager loading.
    3. The Authorization Hole Nobody Noticed

      A regular user triggers an admin-only refund and money disappears. We'll audit routes, discover missing middleware, and implement proper policy checks.
    4. Atomic or Die (Or At Least Oversell)

      Two customers buy the last item... and both orders succeeded. We'll reproduce the race condition with concurrent requests and fix it with database locks and atomic operations.
    5. The Case of the Phantom Cart

      Users occasionally see someone else's cart totals. We'll trace the bug to unscoped cache keys and learn when personalized data should never be cached.
    6. The Memory Leak That Killed the Worker

      Receipt generation works for 50 orders, then the worker crashes. We'll profile memory growth, identify Eloquent accumulation in loops, and implement chunking with proper cleanup.
    7. The Timezone Nightmare

      International customers report orders showing wrong dates: "I ordered yesterday but it says tomorrow." We'll untangle mixed timezone assumptions and establish the "store UTC, display local" principle.
    8. The Log File Massacre

      The site returns 500 errors because the disk is full—laravel.log is 47GB. We'll identify runaway debug logging, implement rotation, and establish safe logging practices.
    9. One Search Query. Say Goodnight.

      We watched a simple search like WHERE name LIKE '%query%' turn into a full table scan and lock the database, so we need to tighten up how we handle searches. We'll reject tiny queries, add a limit and paginate() to cap what we pull and then speed things up with Cache::remember() using a key that includes the search and request()->input('page').
    10. The Silent Money Bug (From Mars)

      Order totals don't match line items. We'll expose rounding errors, and rebuild calculations consistently using a custom "value type" object.

Continue Learning