Every thread about solo development eventually gets to the same advice: set up CI/CD, write tests, use staging, never touch production directly. All correct. All things I do not do.
I deploy to production through a PHP file I upload once, visit once, and never see again. It has a token in the URL, needles in the code, and a lint gate that restores the site if I wrote something stupid. Over the last three weeks it shipped 45 changes to two production sites - every single one verified live before I called it done. The ledger is public.
This is how it works, including the parts it took me four tries to learn.
The pattern
A "worker" is a one-shot PHP script that lives in my web root for about ninety seconds. Its whole life looks like this:
php
if (!isset($_GET['t']) || $_GET['t'] !== 'bh-s3cret') {
http_response_code(404); include '404.php'; exit;
}
$src = file_get_contents('index.html');
if (strpos($src, 'PATCH-MARKER') !== false) exit('ALREADY PATCHED');
// needle guard: every anchor must match EXACTLY once
foreach ($needles as $n) {
if (substr_count($src, $n) !== 1) exit('NEEDLE AMBIGUOUS - ABORT');
}
copy($file, $file . '.bak');
$new = str_replace($needles, $replacements, $src);
file_put_contents($file, $new);
exec('php -l ' . escapeshellarg($file), $o, $rc);
if ($rc !== 0) { copy($bak, $file); exit('LINT FAIL - RESTORED'); }
unlink($bak);
unlink(__FILE__);
Token-gated (wrong token = the site's real 404, so it doesn't even look like anything), marker-checked (idempotent - a second visit can't double-patch), needle-guarded (abort if the anchor text matches more or less than once), backed up, lint-gated, self-restoring, self-cleaning.
I build it locally, lint it locally, upload it through cPanel, hit the URL, read the report, delete nothing - it deletes itself.
Dry-runs are free
Half my workers run twice by design. First pass: every check, no write. The report prints needle counts and what it would do. If the counts read wrong - a needle matching 0 or 3 times - I fix the needle and re-run. Nothing was ever at risk.
mode=DRY-RUN / mode=WRITE in the report is the difference between "I think this anchors in the right place" and "I know."
Lessons that cost me deploys
The pattern is 30 lines. The education was not.
Needles must come from raw server source, not the browser. Twice now I've built a needle from rendered DOM and had it fail on disk - once whitespace that the browser normalized, once a middle dot that got mangled into mojibake between my editor and the server. The dry-run caught both. Rule now: needles are ASCII-only, extracted from the byte-exact file, or built positionally (strpos the open tag, find the next close tag, cap the distance).
The verify marker must exist in EVERY file the worker touches. One worker patched two files but carried its marker in only one. File one: patched, verified, written. File two: patched, verified - against a marker that was never inserted - "failed," and restored itself. The guard held so well it fought me. Rule: the verify condition must test exactly what the patch inserts, no more.
A verify threshold must match the payload. A worker that inserts one occurrence of something must not demand two. That sounds obvious. It was not obvious at 7am.
Lint-gate everything, including HTML. PHP gets php -l. Injected JavaScript gets parsed before it ships - one bad regex escape killed a page's entire script while every server-side check stayed green. The site worked; the dropdowns were dead; nobody told me but the verification screenshot.
A worker that scans can match itself. One deployment scanned the web root for files to patch and found its own source code - the real files patched fine, then it "failed" verification on itself and left a backup behind. Workers now exclude realpath(FILE) from every candidate list.
Byte size is a fingerprint. Before writing, the worker reports new bytes, was N bytes. If the delta doesn't match the payload size, something else touched the file. This has caught edge cache lies more than once.
Cache lies. LiteSpeed caches HTML for five minutes and opcache lags a few minutes after PHP writes. A perfect patch will look broken for ninety seconds if you verify through a cached layer. Every live check is cache-busted, and the standing rule is: re-verify after a beat before diagnosing a patch as failed.
Why not CI/CD
Honestly? Partly tooling - my sites are classic PHP on shared cPanel hosting, and bolting on a pipeline meant either a build server or a git hook chain longer than the pattern above. But partly it's this: the worker format forces verification into every deploy. I can't ship without a dry-run report, a marker check, a byte-delta, and a live verification. CI/CD gives you that with YAML and runners. This gives it to me with one file and a URL.
The honest downsides: it's manual (upload, visit, read), the rollback story is one backup deep (older baks get vaulted off-site), and the token in a URL is a shared secret, not auth. If a token leaked, the worst case is a one-shot patch with a needle guard - and the worker is already gone.
What I get back: every change is a reviewed artifact with a report I can paste into a ledger. Forty-five of them are public, each one stamped live-verified.
The full ledger: bryanhamilton.info/receipts
If you deploy solo on boring hosting and have a pattern like this, I want to see it.