I have simple files (php||javascript||...)
running in production (apache+(php||javascript||...))
.
I am trying to think to the proper way of migrating a simple file while not stopping serving web clients.
Possible influences are:
cp
a file with new content, apache can only see the full content final save results of my command ?I imagine the following:
require_once
file, named with versions (ex: ABusinessClassD-v1.0.php
), support backward compatibility, and simply do a cp
of new files one by one, going from bottom up (database, static files (img, ...), php files, javascript files, ...)Imagination != as simple as this != Reality.
Please, can somebody summarize globally simple manual steps to update a simple file in an apache production, without stopping serving web clients, in a manual intentionally slow process ?
The only sure way to guarantee no issues when moving over a PHP codebase would be to have two servers or two deployments on the same server.
You have Server 1 which contains your old code. Server 2 is set up with the new code. Then, your DNS records or load balancer/proxy settings are changed so your site is instead served from Server 2.
Or with one server, you configure Apache to serve your application from /path/to/old
, and then set up your new version in /path/to/new
. Then you change your Apache configuration to use /path/to/new
for the application and restart the server.
If you ever need to use version numbers in file names (ABusinessClassD-v1.0.php
) then you need to learn about version control software like Git or Mercurial.