Skip to content

<div style="display: none;" hidden="true" aria-hidden="true">Are you an LLM? You can read better optimized documentation at /guides/Php85Upgrade.md for this page in Markdown format</div>

Home | Changelog

PHP 8.5 Upgrade Guide ​

This guide shows how to move a shop (a "tenant") from PHP 8.1 to PHP 8.5. It covers Kubernetes and Plesk, and client forks.

1. What changes and who must act ​

  • The PHP 8.5 code work is done. The runtime images for PHP 8.5 are published.
  • Nothing switches by itself. When you merge a release, your PHP version stays the same.
  • Each tenant switches in its own time:
    • Kubernetes tenants switch through the ecnv4_manifests repo (done by its maintainers).
    • Plesk tenants switch in Plesk (done by the server admin).
  • PHP 8.1 is still supported. Dropping it will be announced in a later release.

2. Before you start ​

First safe version ​

The first app version that is safe on PHP 8.5 is 4.130.0 (or any later release). Its changelog says it is the first release safe on PHP 8.5.

These are not safe: 4.129.0 itself, any 4.129.x hotfix, and client builds based on them (for example 4.129.0.x-&lt;client>). The PHP 8.5 fixes (#981, #1016) are not in them. Do not switch to PHP 8.5 on older code.

One-time logout ​

When you switch, every logged-in user (shop and admin) is logged out once, and loses the session cart. The reason: session cookies made on PHP 8.1 no longer match the format that PHP 8.5 expects (see #978).

  • During a rolling deploy, 8.1 and 8.5 pods run side by side. A user can be logged out more than once.
  • Rolling back to 8.1 logs everyone out once more.
  • Switch at a quiet time and roll out quickly.

Test the payment gateways first ​

The payment gateways (Stripe, PayPal, Klarna, Viva, Greek banks) and their server-to-server callbacks were not run on PHP 8.5. Before you switch a live shop, test the gateways that the tenant uses in their sandbox or staging. New clients do this anyway before they go live.

3. Kubernetes steps ​

Do these in the tenant folder of ecnv4_manifests. Do staging first where it exists (for example seajets, seajets-santorini and wecare).

Step 1. Move the app code first ​

Change the adveshop4-app_bootstrap tag to the first safe version (or later) before the runtime. Some tenants still run old code (4.118 to 4.122). That code breaks if only the runtime changes.

Step 2. Clean the php.ini ConfigMaps ​

The php.ini lives in the ConfigMaps. For the web and admin pods, most tenants use app.yaml. The tenants seajets and seajets-santorini have no app.yaml with ini lines. For them the web and admin ini is in app-admin.yaml (their app-front.yaml has no ini lines). The cron ini is app-cron.yaml for all tenants except WeCare. (WeCare has both inis in base/app.yaml.)

Do Step 2 and Step 3 in the same deploy. This applies to the production switch. For a tenant without staging, it is the only switch. Do not apply Step 2 alone. On PHP 8.1, OPcache is loaded only by the zend_extension=opcache line. If you remove it before the image switch, the shop runs on 8.1 without OPcache. If you remove the session.sid_* lines early, the session ids change and users are logged out before the switch.

If staging shares base/ with production, read "Staging first, when staging shares base/ with production" below before you touch these lines.

Remove these lines:

ini
session.sid_length = 26
session.sid_bits_per_character = 5
zend_extension=opcache

(The cron inis have only the two session.sid_* lines. They never had zend_extension=opcache.)

  • session.sid_length and session.sid_bits_per_character are deprecated since PHP 8.4 (so also on 8.5).
  • zend_extension=opcache must go. OPcache is built into PHP 8.5. With the line left in, every PHP start prints "Failed loading Zend extension 'opcache'".
  • Keep the other opcache.* settings. Preload and JIT work on PHP 8.5.

Step 3. Change the image tags ​

In the tenant kustomization.yaml, in the images: block, change the tag of adveshop4-php_fpm and adveshop4-php_cli:

yaml
images:
  - name: ecommercen/adveshop4-php_fpm
    newTag: 1.0.0-8.5.12   # was 1.0.0-8.1.34
  - name: ecommercen/adveshop4-php_cli
    newTag: 1.0.0-8.5.12   # was 1.0.0-8.1.34

These are two entries: ecommercen/adveshop4-php_fpm and ecommercen/adveshop4-php_cli. Together they cover the web, cron, cron-runner and admin pods. Check the exact name: lines in your own file; keep them as they are and change only the tag.

Where the entries live is different per tenant:

  • base/kustomization.yaml for the realm-1-* tenants and for seajets / seajets-santorini production.
  • prod/kustomization.yaml for wecare production.
  • stg/kustomization.yaml for the staging overlays.

Do not switch or roll back the PHP version from ecn-console alone. The ecn-console app config shows these two versions. A change from there only changes the images: block. It does not change the php.ini ConfigMaps. The ini lines must change in the same deploy. On a rollback, a console-only tag change leaves PHP 8.1 without OPcache and with changed session ids. The one exception is the staging step below for tenants whose staging shares base/: there, changing only the tags (for example from ecn-console) is fine.

Staging first, when staging shares base/ with production ​

For seajets, seajets-santorini and wecare, the php.ini ConfigMaps are in the shared base/ folder. Both prod and stg import it (resources: - ../base). Only the image tags are separate (stg/kustomization.yaml, images:).

So if you remove the ini lines in base/ "for staging", you change production too, and at once. These Deployments have the Reloader annotation (reloader.stakater.com/auto: "true"), so a ConfigMap change restarts every prod web and admin pod straight away (CronJob pods pick it up at their next run). All prod pods then run on PHP 8.1 without OPcache and with different session-id settings, and every user is logged out at once.

Do this instead:

  1. For the staging run, switch only the image tags in stg/kustomization.yaml to 1.0.0-8.5.12. Do not edit the php.ini lines in base/ yet.
  2. On 8.5 the leftover lines are harmless. zend_extension=opcache only prints "Failed loading Zend extension 'opcache'" (OPcache is built in and stays on). The session.sid_* lines only give deprecation notices.
  3. Staging still shows the one-time logout. The session-id format differs between 8.1 and 8.5 either way.
  4. For production, remove the three lines in base/ and switch the production tags in the same deploy (Step 2 and Step 3 together). That deploy also changes staging's ini, and Reloader restarts the staging web and admin pods straight away. With the cleaned ini, the session-id format changes again (26 chars at 5 bits becomes 32 chars at 4 bits). So staging users are logged out once more.

The staging run tests the 8.5 image, not the final cleaned ini.

The files are seajets/app/base/app-admin.yaml and app-cron.yaml, seajets-santorini/app/base/app-admin.yaml and app-cron.yaml, and wecare/adveshop4/base/app.yaml.

WeCare's API (wecare/adveshop4/base/app-api.yaml) runs a separate image (ecommercen/wecare-api-php_fpm). This guide does not cover it. Switching WeCare's adveshop4 images does not move the API. realm-1-pharmacydiscount also runs a separate API image (ecommercen/pharmacydiscount-api-php_fpm, today 1.0.0-8.2.35, in its base/kustomization.yaml) that this guide does not cover.

4. Plesk steps ​

These are done by the server admin.

  1. Update the code to the first safe version (or later).

  2. Install PHP 8.5 with the same extensions as on PHP 8.1. Compare the output of php -m on both. You need at least:

    • redis 6.3.0 or newer
    • igbinary 3.2.17RC1 (a release candidate; no stable release supports PHP 8.5 yet)
    • apcu 5.1.28
    • sqlsrv and pdo_sqlsrv 5.13 or newer, if the tenant uses an MSSQL ERP
    • the usual ones: bcmath, calendar, curl, dom, exif, FFI, fileinfo, gd, iconv, mbstring, mysqli, pdo_mysql, soap, xml, xmlreader, xmlwriter, zip
  3. In the domain's PHP settings, make sure these are not set: session.sid_length, session.sid_bits_per_character. Also make sure zend_extension=opcache is not loaded.

  4. Switch the domain, its cron jobs, and the PHP used for composer, to PHP 8.5.

    Do Step 3 and Step 4 at the same time. In Plesk, the domain's additional PHP directives belong to the domain, not to the PHP version. If you remove the lines first, the live 8.1 site changes: every user is logged out once (CodeIgniter tops the session id up to 40 hex characters), and 8.1 may run without OPcache. Then everyone is logged out again after the switch to 8.5. If your server is set up that way, you can instead put the removals into the PHP 8.5 handler's own settings, not the domain's.

  5. Use Composer 2.10.x. Composer 2.8.x prints PHP 8.5 deprecation notices.

  6. Flush the app cache right after the switch. Do it the safe way (see docs/guides/Cache.md, "Pscache Helper Functions"):

    • Use the app's own cache clear: the admin menu item Clear Cache (advisable/clearcache, which runs clearCache('all')). Or clear only this tenant's Redis prefix or database.
    • Before you use Clear Cache on a shared Redis, check that APP_CACHE_L2_PREFIX (or ?prefix= in APP_CACHE_L2_CONNECTION) is set to a value unique to this tenant, or that the Redis database is used only by this tenant. Otherwise it also deletes other shops' cache keys. The reason: RedisAdapter::clear() (src/Cache/Adapter/RedisAdapter.php, through deleteByPattern('*')) deletes every key under its prefix. That prefix is always &lt;tenant prefix>:cache:l2:, so sessions are never touched. But with an empty tenant prefix it is just cache:l2:, which every shop on that Redis shares.
    • Never run redis-cli FLUSHALL. On a shared Redis it also wipes sessions and other shops' keys.
    • APCu lives inside each PHP-FPM process. Restart PHP-FPM. A CLI flush does not clear it.

    Why this matters: with the default setting (serializer=auto in the Redis connection settings), the Redis serializer picks igbinary when it is loaded (code: src/Cache/Adapter/WithRedisOptionsTrait.php:20-27, default in src/Database/Redis/RedisConnectionConfig.php). Check whether your Redis connection sets serializer= explicitly. If it pins serializer=igbinary, the igbinary extension MUST be loaded on 8.5. Cached data written by the old setup may not be readable.

5. Client forks ​

A fork's own copy of a file replaces the main repo's version. So a fix in the main repo never reaches that copy, and an upstream merge does not warn you. The fork-owned file lists are in the __Notes__ of the 4.130 changelog:

  • Dynamic properties (#981, Bitbucket PR #452): the notes on Bulker, SimpleImage and Adv_mailer declaring their properties.
  • Null array offsets (#981, Bitbucket PR #455): the notes listing the fork-owned views under application/views/ that read a nullable array key.

Before you switch, run the PHP 8.5 checks. Both tools are in the main repo's dev dependencies, so run composer install first.

On the shipped configs (they scan the whole tree):

bash
composer run rector:dry-run
composer run php-compat

These two scripts scan the whole tree (system, application, ecommercen, src, patches; see rector.php and .phpcs-compat.xml), not only application/. In a fork, act only on findings in your OWN files (the application/ and custom/ files the fork owns). Do not "fix" the main-owned folders inside the fork.

Composer's default script timeout (300 s) may stop a full-tree run. Run the tools directly instead, or set COMPOSER_PROCESS_TIMEOUT=0:

bash
php -d memory_limit=2G vendor/bin/rector process --dry-run
vendor/bin/phpcs --standard=.phpcs-compat.xml

On custom/ (not covered by the shipped configs, so give the path):

bash
php -d memory_limit=2G vendor/bin/rector process --dry-run custom
vendor/bin/phpcs --standard=.phpcs-compat.xml custom

Notes:

  • These commands need rector.php and .phpcs-compat.xml in the fork. They arrive with the upstream merge of the release that ships them. Merge upstream first.
  • --dry-run only prints findings. It changes no file. Never run rector process without --dry-run before you have read the findings.
  • Both tools exit with a non-zero code when they find something. That is normal. Read each finding.
  • Some findings are style hints, not 8.5 breaks. Example: PHPCompatibility warns about a class called Resource ("soft reserved keyword"). Judge each one.

6. Rollback ​

  • Kubernetes: change the adveshop4-php_fpm and adveshop4-php_cli tags back to 1.0.0-8.1.34. The 8.1.34 images stay published. Switching the tags is not enough. In the same deploy, also restore exactly the lines you removed in Step 2, in the same ConfigMaps. The cron ini (app-cron.yaml) never had zend_extension=opcache; that line was only in the web and admin ini. The full set was:
    ini
    zend_extension=opcache
    session.sid_length = 26
    session.sid_bits_per_character = 5
    Without zend_extension=opcache, PHP 8.1 runs without OPcache. It is slower and shows no error.
  • Plesk: switch the domain (and its cron jobs and composer) back to PHP 8.1. If you removed session.sid_length and session.sid_bits_per_character for 8.5, put back the values you removed (on Kubernetes they were 26 and 5; a Plesk domain may have had other values or none). Make sure OPcache is enabled again for 8.1.
  • Everyone is logged out once more.

7. What was verified ​

  • The images ecommercen/adveshop4-php_{base,cli,cli_dev,fpm,fpm_dev} at 1.0.0-8.5.12 are on Docker Hub. The 1.0.0-8.1.34 and 1.0.0-8.1.32 images are still there.
  • The 8.5 image has the same php -m list as the 8.1.34 image.
  • The PHP 8.5 fixes of #981 were checked at runtime on the local PHP 8.5 stack.
  • Not tested on PHP 8.5: the payment gateways and their callbacks. Test them per tenant (see section 2).