4 ms·
> Modern php code uses Frameworks, Package mangers, opcode caching, and application servers. How do these change the way you can deploy PHP files by simply upl
by mekster 3y ago
> Modern php code uses Frameworks, Package mangers, opcode caching, and application servers.
How do these change the way you can deploy PHP files by simply uploading them?
For frameworks, all you do is run a single command to install.
If you mean JS package managers, that's agnostic to what language you use.
Opcode caching doesn't require anything special from deployment point of view and I don't see a need for app server for PHP.
- 9dev 3y agoIt changes deployment because you need to flush the opcache after deploying new code, for example; you need to install composer packages, restart the app server (if you use one), etc. I mean obviously you still upload files, but there are more steps involved in a proper deployment. Once you start getting into zero-downtime deployments, you'll quickly see the need for both application servers like Swoole or RoadRunner, as well as strategies that don't leave requests in the air with half the code from the old version and the other half with the new one. Let HackerNews hobby programmers snark all they want, those are very real problems with very real solutions.
- lsaferite 3y agoI mean... using a symlink to the deployment root gives a quick atomic swap. You update the link, then reload the server config, no downtime and no partial deployments during a request. This also solves for the opcache freshness as well if I recall correctly. (It's been a little bit since I've done any PHP work)
- 9dev 3y agoOf course, you can do that. It’s the strategy Etsy used, for example. Point still standing, that makes deployments definitely more complex than just „uploading a file“. And then again, you’ll end up wondering why your servers should waste cycles upon cycles for executing the same bootstrap code over and over again, if they could instead only do that once, keep the app in memory, and only execute the request handling code… and just like that, you’ll end up with Octane, or Swoole, or what-have-you.