After this lesson you can prepare a deployment plan that serves only public files, installs locked production dependencies and keeps runtime data separate from release code. Preparing is not the same as deploying. This course does not publish anything or modify mrhimanshu.com's hosting.
Begin with the application boundary
The bookshop is a dynamic PHP application. It is not made deployable by copying its templates into a static website output directory. Requests need a PHP runtime, the installed framework, the configured database and appropriate writable storage. The learning website can host the tutorial text without running the demonstration application itself.
The web server's document root should point at the release's public directory. Application code, vendor, tests, configuration and writable storage must not become ordinary public downloads. If a hosting plan cannot set the document root cleanly, consult the official deployment guidance rather than improvising by moving sensitive files into the public directory.
Release code: /home/you/bookshop-release/
Document root: /home/you/bookshop-release/public/
Private runtime storage: outside the document root
Environment: production, with host-specific secret provisioning
External write policy: denied until reviewed authentication existsThese paths are generic planning examples, not captured server configuration. The host's actual layout and runtime account must be confirmed. No remote server, account or live domain was used for the course checks.
Install from the lock file
A deployment should reproduce reviewed dependency versions rather than silently resolve new ones. In an isolated release rehearsal, we copied application code and its lock file into a second temporary directory and installed without development dependencies.
composer install --no-dev --no-interaction --prefer-dist --optimize-autoloader
composer check-platform-reqs --no-devThese commands were run only in that temporary release rehearsal. Example output captured on 2026-11; yours will differ. Selected output is shown; dependency progress and runtime-specific paths are omitted.
Installing dependencies from lock file
Verifying lock file contents can be installed on current platform.
Generating optimized autoload filesPlatform checking verifies requirements against the executing PHP environment. It does not prove that PHP-FPM or another web runtime uses identical configuration. Confirm the hosting runtime separately. A production artifact without test packages should still be built from a revision whose tests already passed in a development-capable verification workspace.
Provision configuration and persistent storage
Set the real base URL, production environment and appropriate cookie security through a reviewed host configuration. Supply secrets securely when the application actually needs them. Do not package a developer's environment file or expose broad diagnostics to check a setting.
SQLite data must survive application releases. If each release directory contains a fresh empty database path, switching releases can make records appear lost. Define a persistent private location, its permissions and how the application configuration points to it. Apply the same reasoning to private uploads and any session storage that must survive the release process.
This course's local path under writable is suitable for its disposable exercise. A production storage plan needs explicit ownership and backup decisions. Do not use a recursive world-writable permission change as the default solution to a denied write.
Plan schema changes before serving traffic
Migrations are state changes. Check the intended database, backup availability and compatibility before applying them. A code rollback does not necessarily reverse a migration safely, and a down method that drops a table is not a data restoration strategy.
The fictional course app has no real records to preserve, but a live deployment would. Rehearse migration and recovery in staging with nonprivate representative data. Keep write access denied while authentication and authorization remain unfinished. A successful package install is not evidence that an editor route is safe.
Treat optimization as an optional reviewed step
CodeIgniter documents optimization commands and configuration caching. Caches can retain configuration values until invalidated. Do not add an optimization step you cannot explain and then assume later environment changes immediately take effect. This beginner deployment plan uses Composer's verified autoloader optimization and leaves framework caching changes for a separate controlled check.
The fetched official Deployment guide and Composer basic usage support the deployment mechanisms discussed here. Our release rehearsal verifies local package preparation, not HTTPS, web-server rewrites, filesystem permissions or production availability on an unspecified host.
Common mistakes
Serving the project root exposes unnecessary files. Running update during deployment can introduce unreviewed dependency changes. Replacing runtime storage with every code release loses persistence. Forgetting that configuration can be cached makes fixes appear ineffective. Finally, deploying local CRUD without an access boundary turns a learning exercise into an unprotected editor.
Exercise
Review a proposed release that serves the entire project, runs composer update and recreates writable on each deploy. Identify three failures and explain what evidence is still required even after the corrected local dependency installation succeeds.
Show an answer
Serve only public, install reviewed locked dependencies and preserve private runtime storage across releases. Then verify the actual host runtime, routing, HTTPS, permissions, configuration and recovery plan. Local artifact preparation does not establish those host-specific properties or complete the missing editor authentication integration.
Previous lesson · Next lesson · Related: explicit routes · Related: security boundaries
Key points
- Deployment requires PHP execution, not static template copying.
- Install reviewed locked dependencies in the release artifact.
- Host configuration and access control still require separate verification.