Perfbase Is Ready for PHP 8.6
Perfbase Is Ready for PHP 8.6
PHP 8.6 is on its way, and the Perfbase extension will support it from the day it ships. When you upgrade, install Perfbase the same way as before and it will pick the build for your PHP version. Every PHP version from 7.4 to 8.6 is tested on each build.
Supporting a new PHP release is more than recompiling. A profiler reads the engine’s internals directly, so we went through what 8.6 changed underneath — and while we were there, we added support for three new things PHP 8.6 makes possible.
What’s new for you
1. Stream errors, counted and explained
PHP 8.6 introduces a structured stream errors API: file, socket and wrapper failures carry a proper error code (StreamErrorCode) and can be turned into exceptions, collected silently, or handled by your own callback, instead of only raising a warning.
Perfbase now records these as runtime events alongside your errors and exceptions:
- a count per error code for the trace — how many
ConnectionRefused,NotFound,PermissionDenied… happened during this request, - up to 100 sample errors with their code, the wrapper involved, the message and, for thrown errors, where they were thrown.
Messages are redacted like every other error we store: a URL with credentials in it loses them before it is recorded.
One limit worth knowing: in PHP’s default mode (stream errors raised as plain warnings, nothing stored), PHP never exposes the error code to extensions. Those failures still show up in your trace — as the warnings they are — but without the code. Switch the stream context to exception, silent or “store” mode and you get the full picture.
2. Time spent waiting in Io\Poll
PHP 8.6 also ships a native polling API, Io\Poll\Context, for waiting on many sockets and streams at once — the building block for event loops and async libraries. When your code (or a library it uses) calls Io\Poll\Context::wait(), the trace now shows that call with the poll backend in use (epoll, kqueue, …), the timeout it waited with, and how many events came back. It’s the first place to look when a request spends its time waiting rather than working.
Both features are part of a new flag, PERFBASE_FLAG_STREAMS, which is on by default. It does nothing on PHP versions before 8.6 and costs nothing unless a stream error happens or Io\Poll is used.
3. How much curl actually delivered
With PHP 8.6 and libcurl 8.20 or newer, curl_getinfo() reports size_delivered: the bytes handed to your application after content decoding. Perfbase records it on every traced curl_exec() call as bytes_delivered, next to the existing download size — useful when a compressed response balloons once it’s decoded.
Things that look different on 8.6 (and why)
PHP 8.6’s compiler got smarter, and that shows up in traces:
printf()with only%sand%dis compiled into plain string interpolation. There is noprintfcall any more, so it no longer appears in your call tree.array_map()with a first-class callable (array_map(strtoupper(...), $items)) or a partial-application callback is compiled into a loop. Thearray_mapnode disappears; the callback calls are still recorded.
That’s PHP doing less work, not the profiler missing something.
Partial function application, the headline language feature of 8.6, creates a new kind of closure under the hood, and PHP 8.6 can also hand out the same cached closure object again. Both are recorded under their own names with correct call counts — we added dedicated tests for exactly these cases.
Under the hood
For the curious: PHP 8.6 profiles exactly like 8.2 onwards — through PHP’s observer API, with hooks attached lazily on the first perfbase_enable() of a request, so idle overhead stays low. The engine changes that needed work were small but sharp: a removed piece of exception state our protected call-outs relied on, a removed C macro, and engine constants that became C23 enums. Each was caught by the build or the test suite before release.
Every build runs the full test suite, our real-PHP probe scripts and a PHP-FPM soak against PHP 8.6 — the same as on every other supported version — so it’s ready before you are.
Getting it
Install or update the extension the usual way; the installer picks the build that matches your PHP version:
bash -c "$(curl -fsSL https://cdn.perfbase.com/install.sh)"New to Perfbase? Start with the setup guide, or create a free account. And if you want to know what the extension costs per function call, we wrote up how we halved it.
Building Perfbase - PHP performance monitoring for teams. Passionate about making PHP applications faster and more observable.
Related posts
Official WordPress Support Is Here
Next →How We Halved the Cost of Profiling a PHP Function Call
Ready to profile your PHP application?
Start on the free-forever plan. No credit card required.