Challenge 1: Write Production .env Values — Possible Solution ==================================================================== # BEFORE — unsafe for production APP_ENV=local APP_DEBUG=true APP_KEY= QUEUE_CONNECTION=sync # AFTER — corrected APP_ENV=production APP_DEBUG=false APP_KEY=base64:GENERATED_VALUE_HERE QUEUE_CONNECTION=redis # Command to generate the missing APP_KEY: php artisan key:generate WHY EACH CHANGE MATTERS --------------------------- 1. APP_ENV=production (was local) Signals to Laravel and various packages that this is a production environment — some packages and Laravel internals behave differently based on this value (e.g. certain debug tooling only activates in non-production environments). 2. APP_DEBUG=false (was true) The exact same risk as Django's DEBUG setting: with APP_DEBUG=true, an unhandled exception shows a detailed error page with full stack traces, file paths, and potentially sensitive configuration values to any visitor who triggers an error. In production this must be false so visitors see a generic error page instead. 3. APP_KEY must be set (was empty) Without a real APP_KEY, Laravel cannot encrypt session data or other encrypted values — the application throws "No application encryption key has been specified" on the very first request that touches a session, making it completely unusable. Running php artisan key:generate creates a new random key and writes it directly into .env — this must be run (and the resulting .env value deployed) before the application can function at all in this environment. 4. QUEUE_CONNECTION=redis (was sync) With sync, every "queued" job actually runs synchronously, inline, blocking the HTTP request that dispatched it — completely defeating the point of using jobs for slow work in the first place. Production needs a real queue backend (redis, database, etc.) paired with an actual running queue:work process to get the intended non-blocking behavior. WHY THIS WORKS -------------- - Every one of these four settings was specifically flagged as a gotcha somewhere across both Laravel courses (APP_KEY in Course 1 Chapter 1, QUEUE_CONNECTION in Course 2 Chapter 5, APP_DEBUG in this chapter) — this challenge deliberately combines all of them into one realistic .env audit, mirroring how a real pre-deployment checklist would need to catch all of these at once, not just one at a time. - Each of these is an environment-specific value that should differ between local development and production — none of them should be hardcoded identically across every environment, which is exactly why they live in .env rather than directly in version-controlled PHP files.