A release which works in an administrator’s shell can still fail for the account serving the website. I run the preflight with the intended PHP runtime and service identity before switching traffic. That catches inaccessible configuration and runtime directories while the previous release is still available.
A permission error is not a reason to make the file public
When a required file cannot be read, I check which account should own and use it. Giving everyone access can hide a deployment mismatch while weakening the file’s protection. I make the check match the application’s intended access instead.
This sounds small, but it asks the right question: can the process which will serve the site read and execute the new release? A successful command run as an unrestricted administrator cannot answer that on its own.
Check the identity and the PHP binary together
I use the relevant PHP version explicitly and run the preflight under the intended service identity. The command-line and web runtimes can still load different configuration, so a command-line boot is one check rather than a complete simulation of PHP-FPM.
I inspect file access, required extensions and writable runtime directories without printing secrets into the deployment log. The goal is a clear pass or a useful failure, not a diagnostic dump of the shop’s private configuration.
Fail before switching traffic
The new release is prepared separately. Entry-point linting and an application boot happen there before the live symlink is changed. If either check fails, the incomplete release is discarded and the previous one continues serving.
A missing required file should be an explicit failure too. A loop which simply skips every path it cannot find could give a comforting result while checking very little. I distinguish genuinely optional files from the entry points the application needs to run.
Shared files deserve their own checks
Uploads and other persistent directories often sit outside a release and are linked into it. I verify that the service account can traverse the parent directories and access the intended files through those links. The link existing is not enough.
I also avoid a blanket recursive permission rewrite on every deployment. Fixing only the ownership or mode which is wrong makes the release process more predictable and reduces unnecessary work across a large shop installation.
Follow the switch with a customer-facing check
After promotion I request a real page through the web server and check the shopping paths appropriate to that change. That catches routing and web-runtime differences a successful CLI boot cannot see.
This complements testing the PHP versions I support and having an atomic release and rollback process. The release needs the right code, the right runtime and the right access to its files.