I'm planning on creating a bunch of PHP scripts in a phar archive (for easy deployment) and allowing it to self-update from a known repository.
How should a phar archive, on a live website, update itself? Not update its contents, but just replacing itself (from a new.phar
previously downloaded to /tmp
or something) would be enough.
I'm specifically concerned about pitfalls on "replacing myself" in PHP, also considering requests could be underway (the script will primarily be called from the web, by AJAX).