PHPRay — every PHP request, recorded
Always-on request tracing for PHP. PHPRay records what every
request to your site actually did: wall time, CPU, memory, every SQL query as a
fingerprint with the literals stripped, every outbound HTTP call, PHP errors and
N+1 patterns. Not a sample — every request, so the checkout that failed at 03:00
is still there at 09:00.
It is a C extension plus a single Go binary. No agent that needs root, no
network egress from the PHP process, no SaaS account required. It runs on shared
hosting (CageFS, LiteSpeed, mod_php), on a VPS and in containers, on PHP 8.0–8.5,
glibc and musl, amd64 and arm64. The core is Apache-2.0.
What it answers
- Which plugin is slowing the site down — time attributed per
WordPress plugin, theme and vendor package, measured on real traffic.
- Which query costs the most — SQL fingerprints ordered by the
time they actually take, not by how slow one call looks.
- What happened in that one failed request — the whole trace:
PHP time, database time, outbound calls and the error that ended it.
What it costs to leave on
We measured our own overhead and published the method and the raw numbers,
including the inconvenient ones. On a WordPress page rendering in 48 ms the
request-recording layer could not be separated from the baseline; the per-plugin
breakdown costs about 4%. Xdebug's profiler on the same kind of page took 25×
longer and wrote 1.2 GB of dumps from sixty requests.
Read more
Install: curl -fsSL https://phpray.dev/install.sh -o phpray-install.sh,
read it, then run it. Source and issues:
github.com/stephen1137/phpray.