KC SoftwareSUPPORT
← All articles

Troubleshooting · Oct 2026 · 2 min read

It works on my machine: finding bugs that only happen in production

When code works locally and fails on the server, the difference is in the environment. Here is where to look.

Start with the logs on the server, not with the code. The error message in production often names the exact file, setting or service that is missing, and guessing without it wastes time.

Compare the environment variables and configuration. A missing or different value, such as a database address, an API key or a feature flag, is the most common cause. If your framework caches its configuration, make sure the cache was rebuilt after the change.

Compare versions: the language runtime, the database and every dependency. A lock file keeps dependency versions the same everywhere, but only if it is committed and actually used during deployment.

Watch for differences in the operating system. Most servers run Linux with case-sensitive file names, while macOS and Windows usually do not care about case. A file named Header.php and a reference to header.php work on a laptop and fail on the server.

Check file permissions, time zones and anything that depends on the server's own disk, such as uploaded files or a local cache. These rarely matter locally and often matter in production.

Once you have a theory, reproduce the problem locally with production-like settings. A bug you can reproduce is a bug you can fix with confidence.