Menu

Live-Verified #1: No SSH, No Pipeline - The Self-Deleting PHP Pattern That Keeps My 1,000-Page Site Alive
📰

Live-Verified #1: No SSH, No Pipeline - The Self-Deleting PHP Pattern That Keeps My 1,000-Page Site Alive

DEV Community: php·Bryan Hamilton·9 days ago
#SCShtfJp
#devto#dev#deploy#production#file
Reading 0:00
15s threshold

I run The DJ Calendar - about 1,000 pages of PHP/MySQL on shared cPanel hosting. No shell. No SSH. No deploy pipeline. LiteSpeed caches HTML for 5 minutes, and opcache serves stale output for a minute after every write.

Pasting a code change into a production file through a browser file manager is how sites die. So over months of live deploys I built a worker pattern that makes that kind of deploy survivable - and I open-sourced it: guarded-deploy-workers .

What a "worker" actually is

A worker is a single PHP file I upload to the web root and hit once with a secret token. The skeleton is ~100 lines:

<?php if ( ! isset ( $_GET [ 't' ]) || $_GET [ 't' ] !== TOKEN ) { http_response_code ( 404 ); include '404.php' ; exit ; // real 404 - never leak the worker } $src = file_get_contents ( $file ); if ( strpos ( $src , 'PATCH-MARKER' ) !== false ) exit ; // idempotency foreach ( $needles as $n ) // counted anchors if ( substr_count ( $src , $n ) !== 1 ) exit ; copy ( $file , $file .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.