Controlled PHP 8.5 installation on Debian 13
Verify PHP8.5 provenance, plans and archives; install six packages once and independently confirm masked, inactive vendor services.
Installation and subsequent steps require PHP 8.5.12 or a newer stable release in the 8.5 branch. PHP 8.5.12 is a security release; the coordinated disclosure is discussed in OpenAI’s report. Check both CLI and the running FPM version: an updated package on disk alone does not establish that an existing process has been updated.
Before connecting PHP to Nginx, we need to choose a source for the required version and inspect which services its packages try to start. Our application requires PHP 8.5 or newer. Debian 13's default php-fpm package selects the 8.4 branch, so apt install php-fpm does not meet this project's requirement.
We performed this manual exercise in a separate disposable Debian 13 VM with one CPU and 1 GiB RAM. These are test-machine results, not changes to the production server or a reconstruction of the earlier E01 setup.
Make the package source explicit
We chose the maintainer's packages.sury.org repository for PHP 8.5. This is an additional source with its own trust key. Its official instructions describe a separate keyring and Signed-By.
We fetched the keyring package over HTTPS, extracted only the public key and verified the InRelease signature. We did not install the keyring package or run its maintainer scripts. Initial trust relied on the official HTTPS source; we did not perform an independent out-of-band key ceremony.
Our separate repository source file contains:
Types: deb
URIs: https://packages.sury.org/php/
Suites: trixie
Components: main
Architectures: amd64
Signed-By: /etc/apt/keyrings/solution200-php.gpg
Signed-By limits the key to this source. A separate preferences file assigns priority 500 to php8.5-* and php-common from this origin, and 100 to its other packages. That constrains candidate selection instead of freely replacing the whole system. The rules are documented in apt_preferences.
Plan and download before installing
After one index refresh, we read the exact candidate versions, checked the signed package list and ran a simulation. This is an adapted example: replace VERSION with the full, identical version for both PHP packages in your verified plan.
apt-cache policy php8.5-cli php8.5-fpm
apt-get --simulate --no-install-recommends install \
php8.5-cli=<VERSION> php8.5-fpm=<VERSION>
The actual plan contained six new packages and no upgrades:
| Package | Purpose |
|---|---|
| php8.5-cli | Command-line PHP |
| php8.5-fpm | The FastCGI process manager |
| php8.5-common | Shared files for this branch |
| php8.5-readline | A dependency of the selected CLI package |
| php-common | Shared Debian PHP helpers |
| libargon2-1 | A library required by the selected set |
The archives totalled 6,617,028 bytes. We downloaded them first and checked their SHA-256 hashes and sizes against APT metadata. Installation could then use --no-download. Downloading alone did not install PHP.
Maintainer scripts also change service state
We read the scripts from all six archives. The FPM package can request a service start or restart, while php-common also interacts with phpsessionclean.service and phpsessionclean.timer. Protecting only php8.5-fpm.service would therefore leave another service-state path.
Our checked initial machine had no conflicting owned files. Before installation, we created three persistent masks pointing to /dev/null and a policy-rc.d that returns 101 only for these PHP units. Other units receive 0. This is an excerpt from the actual policy:
if [ "$1" = "--quiet" ]; then shift; fi
case "$1" in
php8.5-fpm|php8.5-fpm.service|phpsessionclean|phpsessionclean.service|phpsessionclean.timer)
exit 101 ;;
*) exit 0 ;;
esac
The full file also has a #!/bin/sh shebang, belongs to root and uses mode 0755. This example assumes an initially unused path; an existing policy on another server must not be blindly overwritten. We recorded ownership evidence for the files and masks before installation.
One installation followed by independent readback
APT used the downloaded archives, exact versions and --no-install-recommends, then exited with status 0. Denied-start messages were expected, but those messages alone did not prove that the packages were healthy.
We separately read dpkg state, ran dpkg --audit, checked versions and unchanged owned startup guards, and looked for an FPM process. These are reduced actual results:
The actual PHP 8.5.11 result from the first exercise is retained below. It is an initial observation; new installations use at least 8.5.12. CLI and live FPM on the current combined fixture have both been verified as 8.5.12.
Installed packages: 6
Package upgrades: 0
PHP_VERSION: 8.5.11
dpkg --audit: empty
php8.5-fpm.service: masked / inactive / MainPID=0
phpsessionclean.service: masked / inactive / MainPID=0
phpsessionclean.timer: masked / inactive
Default FPM PID and socket: absent
This is a summary of verified checks, not the raw combined output of one command. Individual responses and archive/file hashes remain in the private ledger. We did not repeat installation to obtain a cleaner report.
The result of this step
The first exercise installed PHP 8.5.11 with verified package provenance and controlled vendor-service state. FPM is not yet serving a website. Application extensions, pools, directory permissions, Nginx integration and startup enablement require their own decisions and checks.
Installation through the CLI
After the manual exercise, this stage was implemented and verified through the CLI on another clean Debian VM. Foundation creates its owned key, source, preferences, policy and masks; a separate generic package command refreshes metadata. Packages reuses the same lower APT owner, exact plan and six new archives. There is one installer.
The following read-only command belongs to the verified local implementation. Variables identify previously prepared private files and approved key and plan hashes. The password is not a command-line argument. This is not yet a published CLI release or a complete server setup wizard.
deploy-cli host fpm packages-verify \
--env-file "$ADMIN_ENV" --request-file "$ADMIN_REQUEST" \
--fpm-file "$FPM_PROFILE" --key-file "$REPOSITORY_KEYRING" \
--key-sha256 "$REPOSITORY_KEYRING_SHA256" \
--dependencies-file "$PACKAGE_DEPENDENCIES" \
--plan-file "$PACKAGE_PLAN" --plan-sha256 "$PACKAGE_PLAN_SHA256"
Reduced actual result: verification passed without writes; replaying the committed apply also left files unchanged. For each successful apply, SSH logs confirmed two separate logins for the change and independent verification. Installation retained the PHP service masks; the following article covers the separate start.
status=passed
write_performed=false
new_packages=6
upgrades=0