An application that works on a laptop has passed one test: it works on that laptop. Production is a different machine with different software, different permissions, real data and nobody watching the terminal. Most first deployments fail in a small number of predictable ways, and almost all of them can be checked for in advance.

This is a list of those failures, roughly in the order they tend to appear, with what to do about each. The examples are Laravel and Nuxt, but the categories apply to any web application.

The environment is not the one you developed in

Symptom: a white page, a 500 error, or behaviour that differs subtly from local.

The usual causes are a different PHP version, a missing extension, or configuration that was never set.

Check the runtime first. A framework that requires PHP 8.2 will fail on a host still serving 8.0, and command-line PHP is often a different version from the one the web server uses.

php -v
php -m | grep -E 'pdo_mysql|mbstring|openssl|fileinfo|gd|curl|xml'

Then the configuration. In production:

APP_ENV=production
APP_DEBUG=false
APP_URL=https://api.example.com

APP_DEBUG=true on a public server is the most serious item on this page. A debug error page prints environment variables — database passwords and API keys included — to anyone who can trigger an exception.

APP_URL is easy to overlook and quietly important: generated links, storage URLs and queued emails are all built from it. Leave it as http://localhost and every uploaded image on the live site points at the visitor's own machine.

Configuration is cached, and stale

Symptom: you changed .env and nothing happened.

Laravel can cache configuration into a single file for speed, and production deployments should do so. The consequence is that .env is no longer read at runtime. After any change to it:

php artisan config:cache
php artisan route:cache
php artisan view:cache

The related trap is calling env() outside the config files. Once configuration is cached, env('SOMETHING') in a controller returns null. Read environment values in config/*.php and use config() everywhere else.

The web server points at the wrong folder

Symptom: the site shows a directory listing, or .env can be downloaded.

The document root must be the public directory, not the project root. Everything above public — the .env file, the source code, the logs — must be unreachable from a browser.

On shared hosting where the document root cannot be changed, keep the application outside the web folder and place only the contents of public inside it, adjusting the paths in index.php. Do not solve it with a rewrite rule that tries to hide the other files; one mistake in that rule exposes them all.

Files cannot be written

Symptom: "failed to open stream: Permission denied", or uploads that vanish.

The web server's user needs to write to two places: storage and bootstrap/cache. Nothing else.

chown -R www-data:www-data storage bootstrap/cache
chmod -R ug+rwX storage bootstrap/cache

Avoid chmod 777. It appears in a great many tutorials because it makes the error go away, and it does so by letting every user on the machine write to your application.

Uploaded files need one more step — the link from the public folder to storage:

php artisan storage:link

Without it, uploads save successfully and every image returns 404. On hosts that forbid symbolic links, configure the public disk to write inside public directly.

Also check the upload limits. PHP's upload_max_filesize and post_max_size — and the web server's own request-size limit — are frequently lower in production than the application's validation rule allows, and the resulting error is not always a helpful one.

The database is different

Symptom: a migration fails, or text turns into question marks.

Three things differ most often.

  • Version. A feature that works on MySQL 8 may not exist on an older MariaDB. Develop against the version you deploy to.
  • Character set. Use utf8mb4 throughout. The older utf8 cannot store four-byte characters, which includes emoji and some scripts.
  • Strictness. Production servers often run in strict mode, where a value that was silently truncated locally becomes an error.

Run migrations with the flag that confirms you mean it, and never with the commands that destroy data:

php artisan migrate --force

migrate:fresh and migrate:refresh drop tables. They have no place in a deployment script. Take a backup before every migration that alters existing tables, and know how you would restore it.

Nothing happens in the background

Symptom: emails are never sent; scheduled reports never appear.

Queues and the scheduler do not run themselves. Locally you start a worker in a terminal and forget about it. In production, something has to keep it alive.

The scheduler needs one cron entry:

* * * * * cd /path/to/app && php artisan schedule:run >> /dev/null 2>&1

Queue workers need a supervisor — systemd or Supervisor — that restarts them when they exit, and they must be restarted on every deployment, because a running worker keeps the old code in memory:

php artisan queue:restart

On hosting without long-running processes, run the worker from cron with --stop-when-empty, or design the long tasks to be driven in batches by repeated requests. Do not leave the queue driver on sync and hope the slow work fits inside a web request.

The front end was built for the wrong place

Symptom: the site loads and every API call goes to localhost.

A JavaScript front end has two kinds of configuration: values read when it is built and values read when it runs. Confusing them produces a build that works in one environment only.

With Nuxt, runtime config can be overridden by environment variables when the server starts, so one build can serve several environments:

NUXT_PUBLIC_API_BASE=https://api.example.com/api/v1 \
NUXT_PUBLIC_SITE_URL=https://example.com \
node .output/server/index.mjs

But anything used inside nuxt.config itself — an allowed image domain, for example — is fixed at build time. Set those variables before nuxt build.

Then the mirror image on the API: allow the front end's real origin in the CORS configuration. Server-rendered pages will work without it, because servers do not enforce CORS; the first form submitted from a browser will not.

HTTPS is half-configured

Symptom: mixed-content warnings, redirect loops, or links generated with http://.

Behind a load balancer or a CDN, the application receives plain HTTP and has to be told the original request was secure. Configure trusted proxies so the framework reads the forwarded headers; otherwise it will generate insecure URLs, and forcing HTTPS will loop.

Set secure cookies in production, redirect HTTP to HTTPS at the web server, and renew certificates automatically. A certificate that expires on a weekend is an outage with a known date.

Nobody is told when it breaks

Symptom: a customer reports the problem before you know about it.

A deployment is not finished until failure is visible.

  • Logs that rotate, so they do not fill the disk — a full disk takes the database down with it.
  • Error reporting that sends exceptions somewhere a person will see them.
  • A health check an external monitor can call, covering the database connection and not only the web server.
  • Failed jobs recorded and reviewed, not silently dropped.

There is no way back

Symptom: the new release is broken and the old one is gone.

Before the first deployment, answer two questions: how do I return to the previous version of the code, and how do I return to the previous state of the data?

For code, deploy each release into its own directory and switch a symbolic link; rolling back is switching it again. For data, that means tested backups — a backup that has never been restored is a hope, not a backup — and migrations written so that a release can be rolled back without losing what was entered in between.

A pre-flight checklist

  1. PHP version and extensions match what the application requires.
  2. APP_ENV=production, APP_DEBUG=false, correct APP_URL.
  3. Document root is public; .env is not reachable.
  4. storage and bootstrap/cache writable; storage:link in place.
  5. Upload limits match the application's rules.
  6. Database version and utf8mb4 confirmed; backup taken; migrate --force.
  7. Config, route and view caches rebuilt.
  8. Scheduler in cron; queue workers supervised and restarted.
  9. Front end built with the production API address; CORS allows its origin.
  10. HTTPS enforced, proxies trusted, certificates renewing.
  11. Logs rotating; errors reported; health check monitored.
  12. A rollback path for code and for data, both tried once.

None of these is difficult. They are simply invisible on a development machine, where everything is already set up and the person who would notice a failure is sitting right there. Going through the list before launch turns a tense afternoon into an ordinary one.