Skip to content

Upgrade Guide

Most PAM upgrades are a single command. Patch releases are compatible by design, but some 2.2.x patches deliberately changed a default to close a security gap. This guide lists every one of those changes, newest first, with an estimate of how likely it is to affect you:

  • High impact: most applications must change something.
  • Medium impact: applications that use the feature must check it.
  • Low impact: only unusual setups notice.

pam self-update downloads a release authorized by PAM’s pinned distribution identity and verifies it before switching:

Terminal window
pam self-update --check # report a newer verified release, change nothing
pam self-update # install the latest release
pam self-update v2.2.27 # install one exact release
pam --version
pam doctor

Downgrades are refused unless you authorize exactly one older version:

Terminal window
pam self-update v2.2.26 --allow-downgrade

You can also pin a version with the installer, which is useful in Dockerfiles and CI images:

Terminal window
curl -fsSL https://github.com/push-in/pam/releases/latest/download/install.sh \
| PAM_VERSION=v2.2.27 sh

Composer packages such as Nimbus, Arcano, and the PAM Native SDK are versioned independently of the runtime. Update them with PAM’s Composer:

Terminal window
pam composer outdated --direct
pam composer update pushinbr/nimbus pushinbr/arcano --with-dependencies
pam test
  1. Run your test suite on the current version with pam test.
  2. Read every section below between your version and the target version.
  3. Upgrade a staging host first and run pam doctor.
  4. Restart or reload the cluster, then check pam ps and pam logs (see Process Management).
  5. Keep the previous release available with --allow-downgrade until you are confident.

Likelihood of impact: Low

Request headers whose names contain _ no longer appear in $_SERVER. This prevents a client-sent X-Forwarded_For from overwriting the HTTP_X_FORWARDED_FOR value a proxy set, matching nginx’s underscores_in_headers off.

If your application reads such a header, read it from the request’s header list instead, where it is still present:

// Before: $_SERVER['HTTP_X_CUSTOM_TOKEN'] for a header named "X_Custom_Token"
$token = $request->getHeader('X_Custom_Token');

Likelihood of impact: Medium

In server mode display_errors is now off and log_errors is on, unless you set the exposeErrors server option. expose_php also defaults to off. Without a php.ini, older releases printed warnings, including file paths, into responses.

Warnings now go to the worker log. During local development you can opt back in:

index.php
$server->listen(8080, '127.0.0.1', [
'exposeErrors' => true, // development only
]);

Likelihood of impact: Low

A worker now serves at most maxConnections connections. The default is the open file limit minus 256 descriptors reserved for PHP. Past the limit, the worker stops accepting until a connection closes, instead of running out of descriptors. Raise the process file limit (ulimit -n) if you serve many idle keep-alive or WebSocket connections per worker.

Likelihood of impact: Low

Projects created with pam init now require pushinbr/nimbus ^0.7 and pushinbr/arcano ^0.2.9. Existing projects are not changed; see Upgrading Nimbus below.

Likelihood of impact: Medium

Behind a trusted proxy, the client address is now the rightmost X-Forwarded-For entry that is not a trusted proxy, not the leftmost entry (which the client controls). Entries must be IP addresses. This value feeds $_SERVER['REMOTE_ADDR'] and rateLimitPerSecond.

trustedProxies accepts CIDR ranges, and the PAM_TRUSTED_PROXIES environment variable (comma separated) adds to it without a code change:

index.php
$server->listen(8080, '0.0.0.0', [
'trustedProxies' => ['10.0.0.0/8', '192.168.1.10'],
]);
Terminal window
PAM_TRUSTED_PROXIES=10.0.0.0/8,172.16.0.0/12 pam start index.php

If you list every hop of a multi-proxy chain, the result is unchanged. If you only listed the last proxy and expected the leftmost address, add the inner proxies too. * still trusts every peer and logs a warning at boot.

Likelihood of impact: Medium

A worker’s metricsPath (/metrics by default) now answers only loopback peers, and not a loopback request that carries X-Forwarded-For, Forwarded, or X-Real-IP (that is, a reverse proxy on the same host). Other peers reach your application’s own route.

If Prometheus scrapes from another host, choose one option:

Terminal window
PAM_METRICS_TOKEN="$(openssl rand -hex 32)" pam start index.php

Configure the scraper to send Authorization: Bearer <token>. The metricsToken server option does the same in code.

Likelihood of impact: Medium

A /ws upgrade from another site’s page (an Origin that is neither listed nor the request’s own host) now gets 403. This stops a page elsewhere from opening a socket with the user’s cookies. Clients that send no Origin header (servers, mobile apps, CLI tools) are unaffected.

If your frontend is served from a different origin, list it:

index.php
$server->listen(8080, '0.0.0.0', [
'websocketOrigins' => ['https://app.example.com'],
]);

PAM_WEBSOCKET_ORIGINS does the same from the environment. When websocketOrigins is empty, corsOrigins is used.

Likelihood of impact: Low

Request bodies held by PHP are now bounded per worker by maxInflightBodyBytes. The default is a quarter of memory_limit; 0 disables the limit and PAM_MAX_INFLIGHT_BODY_BYTES overrides it. A request over the budget waits up to requestTimeoutMs, then gets 503 with Retry-After. Applications that accept many large concurrent uploads may need a higher memory_limit or more workers.

Likelihood of impact: Low

A client’s X-Request-Id is now only a correlation label (response header, access log, $_SERVER['PAM_REQUEST_ID']). The worker always generates the dispatch key. Do not rely on X-Request-Id being unique.

Likelihood of impact: Low

Plain HTTP/1 connections are now served on the PHP worker thread, with no hop to an I/O thread. TLS connections keep the I/O thread. Streamed responses and SSE flush each chunk before PHP runs again. If you measured better results with the previous mode, restore it:

Terminal window
PAM_IO_THREADS=1 pam start index.php

PAM_IO_THREADS accepts 1 to 16.

Likelihood of impact: Low

  • Fiber C stacks are pooled (up to 8 per worker; only memory is reused, never Fiber or PHP state). Set PAM_FIBER_STACK_POOL=0 to disable the pool.
  • DateTimeInterface::format(DATE_ATOM) runs in C. Set PAM_FAST_DATE_FORMAT=0 if you need the PHP implementation.

Likelihood of impact: Low

The post-boot prefork zygote (PAM_PREFORK_BOOT=app) boots your application once and forks workers from the booted state. It is the default for artisan pam:octane. Sockets left open after boot are disconnected before the first fork, and inherited files are reopened per worker. If your framework keeps other per-process resources, reset them with the fork hooks:

\Pam\Fork::beforeFork(static function (): void {
// close connections opened during boot
});
\Pam\Fork::afterFork(static function (): void {
// reconnect or reseed per worker
});

See Memory & State for what survives between requests.

Likelihood of impact: Low

The per-worker stagger now lowers limits to between 75% and 100% of --max-requests, instead of raising them by up to 25%. If you sized --max-requests to the exact point where a memory leak becomes a problem, you now get recycling slightly earlier, never later.

Likelihood of impact: Low

date.timezone now defaults to the system zone (TZ, then the /etc/localtime link) instead of PHP’s UTC fallback. Set it explicitly if your application assumes UTC:

Terminal window
TZ=UTC pam start index.php
pam -d date.timezone=UTC index.php

Likelihood of impact: Low

On Linux with more than one worker, a zygote starts the Zend Engine and OPcache/JIT once and forks workers before any PHP code runs, so workers share one OPcache segment. PAM_PREFORK=0 keeps the previous exec-per-worker model. Least-connections balancing between workers can be disabled with PAM_BALANCE=0.

Package Command Scripts Must Live in Their Package

Section titled “Package Command Scripts Must Live in Their Package”

Likelihood of impact: Low

Package commands are now bounded by the resolved package directory, so Composer path repositories installed as symlinks work. A package that pointed a command at a script outside its own directory must move that script into the package. See Package Commands.

The 2.0.0 release did not remove public runtime APIs. It changed how releases are certified (every official package runs on PHP 8.4 and 8.5 against its newest and lowest dependency graphs) and added pam support and OTLP span export. To move from 1.x:

  1. Install the latest 2.2.x release with pam self-update.
  2. Run pam doctor in each project and apply suggested repairs with pam doctor --fix.
  3. Make sure your project targets PHP 8.5. PAM bundles PHP 8.5 by default and new projects require ^8.5; PHP 8.4 stays available only for explicit compatibility matrices.
  4. If you use pushinbr/pam-http, migrate to Nimbus (next section). If you use Laravel Octane, update pushinbr/pam-octane and read Laravel on PAM.
  5. Read every 2.2.x section above. The changes most likely to need action are the /metrics restriction, cross-site WebSocket origins, and trusted proxies.

Nimbus replaces pushinbr/pam-http, which stays frozen at 2.2.x and receives no new features. The runtime classes keep their names, so most of the work is renaming namespaces:

  1. Swap the package:

    Terminal window
    pam composer remove pushinbr/pam-http
    pam composer require pushinbr/nimbus
  2. Replace namespaces: Pam\Api\ becomes Nimbus\, and Pam\App becomes Nimbus\App. Pam\Http\Request and Pam\Http\Response are unchanged.

  3. Move route declarations into routes.php and load it from your application:

    bootstrap/app.php
    $app = new Nimbus\App();
    $app->routes(__DIR__ . '/../routes.php');
    return $app;
    routes.php
    use App\Controllers\PingController;
    /** @var Nimbus\RouteRegistrar $router */
    $router->get('api/ping', [PingController::class, 'show']);
  4. Use Arcano for the database (ArcanoServiceProvider). Nimbus has no other ORM integration and no illuminate/* dependencies.

Porting from Laravel instead? The pushinbr/nimbus-rector package ships the NimbusSetList::LARAVEL_TO_NIMBUS Rector set for the mechanical part.

Likelihood of impact: Medium for applications using social login or e-mail verification.

  • Social login binds the OAuth state to the client that started it: the start route sets an HttpOnly, SameSite=Lax nimbus_oauth_state cookie, and the callback refuses a state without it. bindStateToClient: false turns it off.
  • E-mail verification tokens are bound to the address they were sent to. Links sent before the upgrade stop working; users must request a new one.
  • Storage uploads of HTML, SVG, XML, or script types are refused with 415 unless you pass allowActiveContent: true.

Likelihood of impact: High for applications using tokens, the admin panel, CORS, or password resets.

  • The bare * token scope no longer satisfies a Gate ability that has neither a definition nor a policy. Define your abilities, or call $app->gate()->wildcardScopesGrantUndefinedAbilities() to restore the old behaviour.
  • The admin panel answers 403 until you define viewAdmin (for example $app->gate()->define('viewAdmin', ...)) or register a before() hook.
  • CorsMiddleware throws when '*' is combined with credentials: true.
  • PasswordResets must be constructed with revoke: or afterReset:. Pass the credentials to revoke on reset, or revoke: [] to opt out.
  • Nimbus 0.6 requires pushinbr/arcano ^0.2.8.

Nimbus’s full deprecation policy and the per-release changelog live in the Nimbus repository.