Invite-only beta · 9 free places left · Managed hosting on AWS

AceMedia HostTalk to us

PHP · DEVELOPMENT · HOSTING

PHP 8.6: useful new features and what to check before upgrading

Clearer timeouts, prepared callbacks and better tools for event-driven work. Here is what interests me in PHP 8.6, where I would use it and how I approach an existing application.

PHP 8.6 is available now. Its new features include Duration, clamp(), partial function application and polling. I would move an existing live application once its dependencies and a development-site test are ready.

What has changed in PHP 8.6?

PHP 8.6.0 arrived on 19 November 2026. PHP runs the server-side code behind websites, APIs and background workers. Even if you never write it, your hosting account may be running it every time someone signs in, submits a form or places an order.

I've been working through this release while testing our hosting tools and plugins. The useful question for me is what it helps us do, and what we need to check before moving an existing application. This article covers PHP itself. My WordPress and PHP 8.6 testing notes go into the site-specific checks and results.

The short version for website owners

PHP 8.6 gives developers more ways to express time, callbacks and configuration. Applications can make use of those additions as their own minimum requirements move forward. Your existing site can also run on a newer PHP engine without being rewritten to use every new feature.

Three questions to put to your host, and ones I ask myself before a change, are: does the application support it, are the extensions it needs available, and can we test a representative journey with a reliable way back? The answer needs to cover the admin area and scheduled work as well as the public homepage.

Clearer timeouts with Time\Duration

The new Time\Duration class represents elapsed time independently of a calendar or timezone. That suits things such as a network timeout or the delay between retries.

It gives me a clearer way to express a worker's time budget. If one setting expects seconds and another expects milliseconds, an unexplained number is easy to misread. A duration carries the meaning alongside the value.

This small PHP 8.6 example illustrates the API:

$jobBudget = \Time\Duration::fromMilliseconds(750);
echo $jobBudget->nanoseconds; // 750000000

I would keep calendar scheduling separate. An event at 10 am next Monday needs a date, timezone and calendar rules. A two-second timeout has a fixed length. The distinction matters for the events and import work I maintain.

Keeping values within bounds with clamp()

clamp() returns a value within the supplied lower and upper bounds. A value outside them becomes the nearest bound. That is useful when a setting has an allowed operating range.

For a batch importer, I might accept a requested batch size, validate that it is an integer, then keep it between the application's smallest and largest sensible batch. The boundary is easier to see when it has a name and sits next to the setting it controls.

This small PHP 8.6 example illustrates the API:

$requestedBatch = 500; // Already validated as an integer.
$batchSize = clamp($requestedBatch, 5, 100);
echo $batchSize; // 100

Clamping is one part of that decision. I still need to validate untrusted input and decide whether a bad value should be rejected rather than silently adjusted. It does not make an arbitrary string safe or give someone permission to change the setting.

Preparing callbacks with partial function application

Partial function application lets me supply some arguments now and receive a closure for the remaining arguments. PHP 8.6 adds placeholder syntax for this.

This small PHP 8.6 example illustrates the API:

$labelJob = sprintf('Job %s', ?);
echo $labelJob('image-import'); // Job image-import

I can see uses in small transformations and callback pipelines where an anonymous function currently repeats an existing call. I would use it where the result is easier to read. An explicit closure is still a good choice when it explains the operation better.

Shared plugins need particular care here. New syntax has to be parsed before an ordinary version check can run. If I promise compatibility with an older PHP version, I keep that syntax out of the files that version loads, or deliberately raise the minimum requirement and test the change.

A polling API for event-driven work

The new polling API offers event-loop libraries access to scalable I/O mechanisms. It is relevant to applications managing several connections and waiting for network activity.

For me, the interesting possibilities are workers and services which spend time waiting on external systems. Whether it helps depends on their design and the libraries they use. Installing PHP 8.6 does not convert synchronous application code into concurrent work. I would start with an isolated worker, a suitable library and a measured workload.

Small language additions that make intent clearer

Readonly properties can now have defaults. A declared default initialises the property, so a constructor cannot assign it again. That can shorten simple configuration objects while keeping their values fixed. A readonly property belongs to an object; a class constant belongs to the class. I choose the one that fits the configuration model.

The release also introduces a SortDirection enum. A named sort direction can make an API easier to understand than a bare boolean whose meaning has to be looked up. PHP's bundled sorting functions do not accept this enum in 8.6; it is available for application and library APIs to adopt.

I assess changes like these when I am already working on the relevant code. Rewriting a working library across many repositories creates review and compatibility work of its own. I want an improvement I can explain and test.

The full changelog matters as much as the feature list

I read the full PHP 8.6 changelog alongside the migration guide. The changelog records fixes across the engine and extensions, including memory handling and OPcache behaviour. A feature announcement alone cannot tell me which application paths to exercise.

One example in the other changes is that fclose(), file_put_contents() and copy() now report failure when flushing or closing the stream fails. That prompts a practical review of our cache and export writers: do they check the return value, keep the previous usable file and avoid announcing success too early?

I also check the backward-incompatible changes. Invalid mode or flag values in functions including array_filter() and pathinfo() now raise ValueError, and default trimming includes form-feed characters. Error handling and exact input processing deserve regression tests when an application relies on the earlier behaviour.

The deprecation list is useful for maintenance work too. Returning from a finally block is deprecated because it can hide an exception or replace a return value. I would fix the control flow and verify the failure path, rather than just hiding the notice.

What the hosting tests have taught me so far

Three useful findings came from testing the surrounding tools. These checks help older supported PHP versions too.

Practical checks from the private upgrade lab
AreaWhat I foundWhat I am doing about it
Maintenance commandsA much newer WP-CLI reduced PHP 8.6 dependency diagnostics from 421 to 14 lines per repeated forms integration run, while the checks still passed.Existing upstream fixes removed the remaining diagnostics in the pinned development-build test. Keep that private candidate separate from the installed stable tool.
Reloading PHPIn-flight two-second requests failed during private reload tests with the default process-control timeout on both 8.5 and 8.6. A five-second setting let those fixtures finish.Agree a drain policy for real request lengths, then test the exact service operation. Five seconds is not a universal safe value.
Publishing generated filesA writer needs to handle short writes and a failed flush or close, as well as an outright failure to open the file.Prepare a complete temporary file, check success, then publish it atomically. Retain the last usable file when publication fails.

The FPM manual defines the process-control setting. Our reload observations come from private tests, with no customer PHP service reloaded. I also reproduced runtime issues around status counters and particular OPcache configurations. I assess those paths against the actual server settings before making a rollout decision.

Extension readiness is a separate gate. Stable Brotli 0.21.1 built and passed a round-trip probe in the isolated 8.6 lab. The tested stable Imagick source needed existing upstream fixes to build, while Redis and igbinary tests used pinned development candidates. A basic image or compression probe is not complete application support, and a patched lab build is not a released production package.

How long will PHP 8.6 be supported?

PHP's published support schedule lists active support for 8.6 through 31 December 2028 and security support through 31 December 2030. I use that window to plan maintenance, alongside the application's own requirements. A new release gives us time to test a move properly while keeping the current supported branch patched.

Will PHP 8.6 make my site faster?

I have not established a production speed percentage for this release. A language benchmark gives useful information about that benchmark. My sites still need measurements of the requests and jobs people actually depend on.

I compare uncached response time, CPU use, memory, errors and completed work under equivalent conditions. For an importer, the useful result might be successful items per minute with a fixed worker limit. For a website, I want both ordinary visitors and signed-in actions represented.

A page already served from a CDN or full-page cache may spend very little time in PHP. Its loading speed can depend more on images, CSS, JavaScript and network conditions. I keep those measurements separate so I know what changed.

What I check before changing a server

  1. Record what is actually running. I check the web PHP process, command-line tasks, loaded extensions and effective settings.
  2. Check application and dependency support. That includes Composer requirements, plugins, image processing, database drivers and any proprietary loaders.
  3. Use an isolated test first. I use disposable data and contain side effects such as mail, payments and external writes.
  4. Exercise the awkward paths. Upload a file, generate an image, handle a failed cache read, run a job to completion and inspect the errors.
  5. Test the route back. I retain the working runtime and check what happens to files, sessions and data written during the test.
  6. Move one representative development site. I collect evidence there before deciding on a wider rollout.

I also budget for running two PHP services during a transition. Their workers and OPcache memory both count. Keeping a fallback available is useful, but it needs enough RAM to remain reliable.

Can AceMedia Host customers use PHP 8.6 now?

Our hosted sites have not moved to PHP 8.6 yet. I am testing it in a private environment first; the supported extension set and development-site canary still need to be ready before I offer a wider move.

What I am doing with PHP 8.6 now

I have run targeted stock WordPress tests and a private FPM/browser test, including returning to PHP 8.5 and back again. The WordPress article records the scope and results. The targeted Core matrix now totals 1,910 cases across two WordPress revisions and both PHP versions, with no failures. Separate network, session and forms checks also passed. These are selected checks; extension packaging, tooling and representative application journeys still gate the rollout.

The changes I can make immediately are often straightforward: check a failed write properly, make a worker's limits explicit, test cache formats in both directions and remove assumptions about a hardcoded PHP version. Many of those improvements also help applications still on an older supported runtime.

Once the runtime, dependencies and application are ready, I can use the new language features where they make the code clearer. I can then judge the upgrade on completed work and measured behaviour.

PHP pixel logo adapted from Colin Viebrock's PHP logo, under CC BY-SA 4.0. The adaptation uses a reduced pixel grid.

PHP 8.6 and WordPressTalk about your hosting

INVITE-ONLY BETA

Tell us about your site.

Nine free hosting beta invites remain for open-source projects, charities, community organisations and other public-benefit work. Tell us what you’re building; we’ll review the fit and reply personally. Fields marked * are required.

Please do not send passwords or private customer data. We’ll use these details to reply. Privacy notice.

Prefer email? Write to [email protected].