Upgrading Ubuntu 24.04 to 26.04 with PHP sites: what breaks
5 min read
Moving from Ubuntu 24.04 to 26.04 moves your sites from PHP 8.3 to 8.5, MySQL 8.0 to 8.4 and OpenSSL 3.0 to 3.5 in one step. What to check before, what breaks, and why a new server is usually the better upgrade.
An Ubuntu release upgrade is not only a new kernel. For a server that hosts PHP sites, going from 24.04 to 26.04 changes almost every layer your application talks to, all at once:
| Ubuntu 24.04 | Ubuntu 26.04 | |
|---|---|---|
| PHP | 8.3 | 8.5 |
| MySQL | 8.0 | 8.4 |
| MariaDB | 10.11 | 11.8 |
| PostgreSQL | 16 | 18 |
| OpenSSL | 3.0 | 3.5 |
| nginx | 1.24 | 1.28 |
The 26.04 column is what we found in the archive of a fresh Ubuntu 26.04.1 system on 12 November 2026.
In short
- Your sites jump from PHP 8.3 to 8.5, skipping 8.4. Test the code on 8.5 before the upgrade.
- PHP configuration does not move by itself:
/etc/php/8.3/stays,/etc/php/8.5/starts with defaults. ppa:ondrej/phpdoes not exist for 26.04. If your server uses it, plan for that first.- The IMAP extension is gone, and MySQL 8.4 turns off
mysql_native_password. - The safer way is a new 26.04 server and moving the sites one by one.
1. PHP 8.3 becomes 8.5
Ubuntu 26.04 has only PHP 8.5. Code that is clean on 8.3 usually runs, but two releases of deprecations arrive together. We ran this on PHP 8.5:
function f(string $a = null) {}
echo (integer) "5";
echo `echo hi`;
Deprecated: Non-canonical cast (integer) is deprecated, use the (int) cast instead
Deprecated: f(): Implicitly marking parameter $a as nullable is deprecated, the explicit nullable type must be used instead
Deprecated: The backtick (`) operator is deprecated, use shell_exec() instead
string $a = nullmust become?string $a = null(from PHP 8.4). Older libraries are full of this.(integer),(boolean),(double)and(binary)casts must become(int),(bool),(float)and(string)(from 8.5).- Backticks must become
shell_exec()(from 8.5).
These are deprecations, not errors: the code still runs. But if the site shows errors on screen, or a framework turns deprecations into exceptions, pages break. And logs fill up fast.
What to do: run your test suite on PHP 8.5 while you are still on 24.04. Update the framework, plugins and Composer packages to versions that list 8.5 support.
2. Extensions that are no longer there
PHP 8.4 moved some extensions out of PHP core. The one that hurts most is IMAP. Ubuntu 26.04 has no php8.5-imap package. Helpdesks, CRMs and webmail tools that call imap_open() stop working.
Also, php8.5-opcache does not exist, because OPcache is built into PHP 8.5. Scripts that install a fixed list of packages fail on that name.
What to do: list what you have and compare.
php8.3 -m > /root/php83-modules.txt
After the upgrade, php8.5 -m should show the same list, minus what you know you do not need.
3. Your PHP configuration is left behind
Everything under /etc/php/8.3/ belongs to PHP 8.3. PHP 8.5 reads /etc/php/8.5/, which starts with default values. That includes:
php.inichanges:memory_limit,upload_max_filesize,max_execution_time.- Your FPM pools in
/etc/php/8.3/fpm/pool.d/: users,pm.max_children,open_basedir. - The socket name. nginx sites that point to
/run/php/php8.3-fpm.sockreturn 502 Bad Gateway until you change them tophp8.5-fpm.sock.
What to do: copy your pool files to the 8.5 directory, change socket names in them and in nginx, and compare the two php.ini files with diff.
4. The Ondřej PPA
Many 24.04 servers use ppa:ondrej/php for a newer or older PHP. Release upgrades turn third-party sources off, and this PPA has no 26.04 packages at all. Its replacement is packages.sury.org/php. See Ondřej's PHP PPA on Ubuntu 26.04.
If a site needs PHP 8.3 or older after the upgrade, that is where you get it. See Running several PHP versions side by side.
5. The database
-
MySQL 8.0 → 8.4. The
mysql_native_passwordplugin is off by default in 8.4. Users created with it cannot log in. Before the upgrade, find them:SELECT user, host, plugin FROM mysql.user WHERE plugin = 'mysql_native_password';and move them to
caching_sha2_passwordwithALTER USER. -
MariaDB 10.11 → 11.8 is a jump over several releases. Take a full dump first.
-
PostgreSQL 16 → 18. The new version is installed next to the old one, and the data stays in the 16 cluster until you run
pg_upgradecluster.
Whatever you run: take a dump, copy it off the server, and check that it can be restored.
6. TLS
OpenSSL 3.5 is stricter than 3.0. Outgoing connections from PHP (curl, SMTP, payment APIs) to very old servers can fail. Test the integrations your site depends on.
The better way: a new server
An in-place upgrade changes all of the above in one maintenance window, with the sites down, and the way back is restoring a full backup.
Moving to a new server changes the same things, but one site at a time:
- Create a new Ubuntu 26.04 server.
- Copy one site and its database to it.
- Test it under a temporary address.
- Change DNS. If something is wrong, change it back.
- Repeat. Turn the old server off when it is empty.
A site that is not ready for PHP 8.5 can run on 8.3 on the new server in the meantime.
This is how we suggest doing it with Zefily: connect the new server, create each site with the PHP version it needs today, test it on its free zefily.app address, then switch the DNS. See Connect a server.
Checklist before you start
- Code tested on PHP 8.5; framework and plugins updated.
- List of PHP extensions saved; IMAP use checked.
- Copy of
/etc/php/8.3/and/etc/nginx/saved. grep -r ondrej /etc/apt/checked.- MySQL users on
mysql_native_passwordmoved. - Database dump taken, copied off the server, restore tested.
- Server snapshot taken at the provider.
Frequently asked questions
Which PHP version do I get after upgrading Ubuntu 24.04 to 26.04?
PHP 8.5. Ubuntu 24.04 has PHP 8.3 and Ubuntu 26.04 has only 8.5, so the upgrade skips 8.4.
Why do my sites return 502 Bad Gateway after the upgrade?
Usually nginx still points to /run/php/php8.3-fpm.sock. PHP 8.5 listens on /run/php/php8.5-fpm.sock, and your old pool files are not copied to /etc/php/8.5.
Can I keep PHP 8.3 on Ubuntu 26.04?
Not from Ubuntu's archive. PHP 8.3 for Ubuntu 26.04 is available from Ondřej Surý's repository at packages.sury.org.
Is php-imap available on Ubuntu 26.04?
No. The IMAP extension left PHP core in PHP 8.4 and there is no php8.5-imap package in Ubuntu 26.04.
Should I upgrade in place or move to a new server?
For servers with production sites, a new server is safer: you move and test one site at a time and can switch back by changing DNS.
See supported systems for what Zefily installs on each Ubuntu release.