Skip to content

Upgrading a production app to PHP 8.4 without downtime surprises

Upgrade a production PHP app to 8.4 with an easy way back. Find deprecated code with PHPStan and Rector first, then run PHP 8.4 beside your current version and switch one site over with a single reload.

If you run a PHP app in production and need to move it to PHP 8.4, you can do it without betting the site on one package upgrade. Install 8.4 next to your current version, give it its own PHP-FPM pool, and point one site at it. PHP-FPM (the FastCGI Process Manager) is the service that runs PHP code for nginx or Apache, and each version can listen on its own socket. Switching a site between versions is a one-line config change and a reload, so going back is just as fast.

Most of the work in an 8.4 upgrade is about deprecations. These are warnings for code that still runs today but will stop working in PHP 9. The steps below start on your laptop, where static analysis tools list those warnings by file and line. Then you install 8.4 on the server and move one vhost (a site’s web server config block) to the new pool. The old pool keeps running until you are sure you no longer need it.

What you’ll accomplish

  • Get a concrete, file-and-line list of what PHP 8.4 will complain about, produced before any server is touched.
  • Install PHP 8.4 alongside your current version on Debian/Ubuntu (Sury) or RHEL-family (Remi) without disturbing the running interpreter.
  • Run a dedicated 8.4 php-fpm pool on its own Unix socket, with its own error log and its own resource limits.
  • Move one vhost to the new socket, verify the version end to end from outside, and move it back with a single reload if anything looks wrong.
  • Bring the deprecation flood under control instead of letting it fill a disk at 3 a.m.

Prerequisites

  • A working app on PHP 8.0 or newer. If you are on 7.x, do that hop first: the 7-to-8 break is much larger than 8.x-to-8.4, and mixing the two migrations makes every failure ambiguous. Our PHP 7 to 8 migration guide covers that step.
  • Composer 2.x and a dependency tree you can actually update. A vendored, hand-patched vendor/ directory turns this into a much longer project.
  • Root or sudo on the web server, plus the ability to reload nginx or Apache.
  • A test suite, or at minimum a list of the ten URLs that matter. You cannot validate an interpreter swap by loading the homepage.
  • Distro reality check: Debian and Ubuntu get multi-version PHP from Sury (packages.sury.org, or the ppa:ondrej/php PPA on Ubuntu). RHEL, AlmaLinux and Rocky get it from Remi, whose parallel packages are named php84-php-* and install under /opt/remi/php84. The two families differ in package names, paths, service names and the web server user, so read the step you are actually on.

If a control panel owns your PHP configuration (cPanel, Plesk, DirectAdmin), stop here and use the panel’s multi-PHP tooling instead. Hand-written pool files get overwritten by the panel’s next config rebuild.

How it works

Nothing about this is clever. A php-fpm master process listens on a socket; nginx or Apache forwards .php requests to that socket over FastCGI; neither side knows or cares which PHP version is behind it. Install a second version, give it a second socket, and you now have two interpreters serving the same files on disk. The vhost decides which one gets the traffic.

Diagram showing an nginx vhost pointing at a PHP 8.2 FPM socket, a parallel PHP 8.4 pool on its own socket serving the same application directory, and a rollback path back to the 8.2 socket

That gives you a rollback that takes one edit and one reload, with no package removal, no reinstall, and no restoring anything from backup. The order of the rest of the work follows from the same principle: do the parts that are free to undo first, and the parts you cannot undo last.

Five-step sequence from static analysis and CLI test runs, through parallel installation and vhost cutover, to removing the old pool, annotated with the rollback cost of each step

The real content of an 8.4 upgrade is deprecations, not fatal errors. Deprecations do not break anything today; they break in PHP 9. What they do today is write a line to your error log on every single request that hits the offending code path, which is how a routine upgrade turns into a disk-space incident.

The one you will hit hardest is implicitly nullable parameter types. Writing function f(Foo $x = null) has always silently meant ?Foo, and 8.4 deprecates it — the explicit ?Foo $x = null is now required. Any codebase with a few years on it has hundreds of these. Alongside it, 8.4 deprecates the E_STRICT constant (it has had no meaning since PHP 8.0, but plenty of error_reporting lines still name it), and deprecates the session.sid_length and session.sid_bits_per_character ini directives, which emit a startup deprecation on every worker if you still set them.

Beyond those, treat the extension-level notes as a category rather than a list to memorise: mysqli and the XML/DOM extensions both picked up deprecations in the 8.4 cycle, and ext/imap, ext/oci8, ext/pdo_oci and ext/pspell were unbundled from core into PECL. Your log, not this article, is the authority on which ones your code touches — that is exactly what step 7 is for. The PHP 8.4 migration page carries the full list.

Step-by-step

1. Write down what you are running now. You will need this to compare against, and you will need it during a rollback conversation.

php -v
php -m | tr '\n' ' '
PHP 8.2.28 (cli) (built: Apr 10 2026 09:12:33) (NTS)
Zend Engine v4.2.28, with Zend OPcache v8.2.28
Core ctype curl date dom exif fileinfo filter ftp gd hash iconv igbinary intl
json libxml mbstring mysqli mysqlnd openssl pcre PDO pdo_mysql redis session
SimpleXML soap sodium SPL sqlite3 tokenizer xml xmlreader xmlwriter zip zlib

2. Ask Composer whether your dependency tree even allows 8.4. This takes two seconds and saves an afternoon.

composer why-not php 8.4
laminas/laminas-code  v4.5.1  requires  php  ~8.0.0 || ~8.1.0 || ~8.2.0

An empty result means nothing blocks you. A result like the above means that package needs an update first — resolve those before you install anything on a server.

3. Point a static analyser at 8.4. PHPStan will evaluate your code against 8.4 semantics without 8.4 being installed. Add the version to phpstan.neon:

parameters:
    level: 5
    phpVersion: 80400
    paths:
        - src
vendor/bin/phpstan analyse --no-progress
 [ERROR] Found 12 errors

4. Let Rector do the mechanical rewrites. The implicit-nullable fix is pure boilerplate and there is no reason to do it by hand. Create rector.php:

<?php

declare(strict_types=1);

use Rector\Config\RectorConfig;

return RectorConfig::configure()
    ->withPaths([__DIR__ . '/src'])
    ->withPhpSets(php84: true);

Always run the dry pass first and read the diff:

vendor/bin/rector process --dry-run
1) src/Mailer/Transport.php:31

    ---------- begin diff ----------
@@ @@
-    public function __construct(LoggerInterface $logger = null)
+    public function __construct(?LoggerInterface $logger = null)
    ---------- end diff ----------

 [OK] 1 file would have changed (dry-run)

5. Install 8.4 beside your current version. On Debian and Ubuntu, from Sury:

sudo apt-get install -y ca-certificates apt-transport-https lsb-release curl
sudo curl -fsSLo /usr/share/keyrings/sury-php.gpg https://packages.sury.org/php/apt.gpg
echo "deb [signed-by=/usr/share/keyrings/sury-php.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/sury-php.list
sudo apt-get update
sudo apt-get install -y php8.4-fpm php8.4-cli php8.4-mysql php8.4-mbstring \
  php8.4-xml php8.4-curl php8.4-intl php8.4-zip php8.4-gd php8.4-opcache
Setting up php8.4-fpm (8.4.10-1+0~20260710.28+debian12) ...
Created symlink /etc/systemd/system/multi-user.target.wants/php8.4-fpm.service

On RHEL, AlmaLinux or Rocky 9, from Remi. The php84-php-* packages install under /opt/remi/php84 and deliberately do not touch the system php:

sudo dnf install -y https://rpms.remirepo.net/enterprise/remi-release-9.rpm
sudo dnf install -y php84-php-fpm php84-php-cli php84-php-mysqlnd \
  php84-php-mbstring php84-php-xml php84-php-intl php84-php-opcache
Installed:
  php84-php-fpm-8.4.10-1.el9.remi.x86_64
  php84-php-cli-8.4.10-1.el9.remi.x86_64

6. Diff the extension lists. This is the step people skip and then debug as a mystery 500.

diff <(php8.2 -m) <(php8.4 -m)
21d20
< imap
30d28
< redis

Two different problems in one output. redis is a PECL extension and needs a build for the new version (php8.4-redis, or php84-php-pecl-redis6 on Remi). imap is one of the extensions unbundled from core in 8.4 — it still exists, but as a PECL package, and both Sury and Remi ship builds. Install what you actually use and re-run the diff until it is empty or you understand every line.

7. Run the suite on the 8.4 CLI with deprecations captured to their own file. Do not send them to your normal error log; you want a list you can sort, not noise mixed into real errors.

php8.4 -d error_reporting=E_ALL -d log_errors=1 \
  -d error_log=/tmp/php84-deprecations.log \
  vendor/bin/phpunit
grep 'Deprecated' /tmp/php84-deprecations.log | sed 's/ in \/.*//' | sort | uniq -c | sort -rn | head -5
    412 PHP Deprecated:  Implicitly marking parameter $logger as nullable is deprecated, the explicit nullable type must be used instead
     31 PHP Deprecated:  Constant E_STRICT is deprecated
     18 PHP Deprecated:  Directive session.sid_length is deprecated

That collapsed list is the actual work queue. Fix the top of it, re-run, repeat. On Remi the CLI binary is php84 rather than php8.4.

8. Give 8.4 its own pool on its own socket. Create /etc/php/8.4/fpm/pool.d/app.conf (on Remi: /etc/opt/remi/php84/php-fpm.d/app.conf, with nginx as the user and group):

[app]
user = www-data
group = www-data
listen = /run/php/php8.4-fpm-app.sock
listen.owner = www-data
listen.group = www-data
listen.mode = 0660
pm = dynamic
pm.max_children = 20
pm.start_servers = 4
pm.min_spare_servers = 2
pm.max_spare_servers = 6
php_admin_flag[log_errors] = on
php_admin_flag[display_errors] = off
php_admin_value[error_log] = /var/log/php8.4-fpm-app.log
php_admin_value[error_reporting] = E_ALL
catch_workers_output = yes

Start it and confirm both sockets now exist:

sudo systemctl start php8.4-fpm
ls -l /run/php/
srw-rw---- 1 www-data www-data 0 Jul 28 22:03 php8.2-fpm-app.sock
srw-rw---- 1 www-data www-data 0 Aug  2 09:41 php8.4-fpm-app.sock

9. Flip one vhost. Keep the socket path in an upstream block so the cutover and the rollback are both one line. In /etc/nginx/conf.d/php-upstream.conf:

upstream php_app {
    server unix:/run/php/php8.4-fpm-app.sock;
}
sudo nginx -t && sudo systemctl reload nginx
nginx: configuration file /etc/nginx/nginx.conf test is successful
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok

Apache with mod_proxy_fcgi uses the same idea in the vhost:

<FilesMatch \.php$>
    SetHandler "proxy:unix:/run/php/php8.4-fpm-app.sock|fcgi://localhost"
</FilesMatch>
sudo apachectl configtest && sudo systemctl reload apache2
Syntax OK

10. Quiet the deprecations once you have the list. Leaving E_ALL on in production after triage is how you fill a partition. Change the pool file and reload:

php_admin_value[error_reporting] = E_ALL & ~E_DEPRECATED
sudo systemctl reload php8.4-fpm

Validate it works

First, prove which interpreter actually served the request — from outside, over HTTP, not from a shell:

echo '<?php echo PHP_VERSION, PHP_EOL;' | sudo tee /var/www/app/public/__ver.php
curl -s https://app.example.com/__ver.php
sudo rm /var/www/app/public/__ver.php
8.4.10

Then confirm the app still answers normally and check the timing has not fallen off a cliff:

curl -so /dev/null -w '%{http_code} %{time_total}\n' https://app.example.com/
200 0.184

Confirm every declared platform requirement is satisfied by the new runtime:

php8.4 "$(command -v composer)" check-platform-reqs
Checking platform requirements for packages in the vendor dir
php     8.4.10  success
ext-intl 8.4.10  success

Finally, watch the new pool’s log for a few minutes of real traffic. Silence here is the pass condition:

sudo tail -f /var/log/php8.4-fpm-app.log

Leave the 8.2 packages and pool installed until the app has been through a full business cycle on 8.4 — a month end, a batch job, a report run. Rollback is sed -i 's/php8.4/php8.2/' /etc/nginx/conf.d/php-upstream.conf followed by nginx -t && systemctl reload nginx, and it stays that cheap for exactly as long as you leave the old pool alone.

Troubleshooting

A Class "Redis" not found or Call to undefined function fatal right after the flip. An extension exists for the old version and not the new one. PECL extensions are compiled per PHP version — installing php-redis once does not cover 8.4. Go back to step 6, run the diff again, install the missing package, then systemctl reload php8.4-fpm. Roll the vhost back first if the site is down; the diff will still be there in five minutes.

nginx returns 502 and the error log says connect() to unix:/run/php/php8.4-fpm-app.sock failed (13: Permission denied). The socket exists but the web server cannot open it. Check listen.owner, listen.group and listen.mode in the pool file against the user nginx actually runs as — www-data on Debian, nginx on RHEL. A (2: No such file or directory) in the same place means something different: the pool never started, or the path in the vhost has a typo. systemctl status php8.4-fpm distinguishes the two immediately.

The deprecation log grows by hundreds of megabytes an hour. Expected, and the reason step 7 exists. Every request through a deprecated code path writes a line. Short term, mask them in the pool with E_ALL & ~E_DEPRECATED and reload. Medium term, fix the top three entries of your uniq -c list, which will usually account for most of the volume. Also confirm the pool’s error_log is covered by logrotate — a file you created by hand in /var/log is not automatically rotated. Our notes on production error reporting cover the sane long-term settings.

Code changes deploy but the site keeps serving the old behaviour. Opcache. Each php-fpm master holds its own shared-memory cache, so the 8.4 pool starts cold and then caches independently of the 8.2 one. If opcache.validate_timestamps=0 (correct for production), a deploy must be followed by a reload of that specific service: systemctl reload php8.4-fpm. Calling opcache_reset() from a web request only clears the cache of the pool that served it. Sizing and revalidation settings are covered in PHP opcache configuration.

Composer suddenly resolves different versions than it did yesterday. Your composer.json probably pins config.platform.php to the old version, so Composer keeps resolving for 8.2 while the interpreter is 8.4. Set it to what FPM actually runs and re-resolve properly rather than reaching for --ignore-platform-req=php, which does not fix the mismatch, it only postpones the crash to runtime:

composer config platform.php 8.4.10
composer update --with-all-dependencies

When this is the wrong approach

If your app has no test suite and no static-analysis baseline, the parallel-pool trick will not save you — it makes the switch reversible, but you still have no way to tell whether the app is behaving correctly on the new runtime. Build the ten-URL smoke check first; that is the actual prerequisite, not the packages.

If you are on 7.x, this is not your guide. The 7-to-8 boundary changed real semantics rather than emitting deprecations, and doing both hops at once means every failure has two candidate causes.

If your blocker is a closed-source extension — a licensing loader, a payment vendor’s SDK, an ancient ionCube-protected module — nothing here helps. No analyser rewrites a binary. Find out whether an 8.4 build exists before you plan anything else.

And if the app runs in containers, do not add a second pool inside a running container. Build a new image on the 8.4 base tag, run the same audit steps against it in CI, and roll it out with whatever deployment mechanism you already have. The parallel-pool pattern is for long-lived servers where the web server config is the switch. Check the supported versions page while you are planning: security support windows, not feature lists, are what should set your deadline.

If this is the kind of work you’d rather never own again, it’s the daily job of Managed Cloud Ops — book an infrastructure review.