A low-overhead sampling profiler for PHP 7+ that works with CLI, Apache, and FPM without requiring code changes.
phpspy is a low-overhead sampling profiler for PHP 7+ applications that captures stack traces from running processes without requiring code instrumentation. It helps developers identify performance bottlenecks in production environments by profiling CLI scripts, Apache modules, and PHP-FPM workers with minimal performance impact.
PHP developers and system administrators who need to diagnose performance issues in live applications, especially those running in production where traditional profilers may introduce unacceptable overhead.
Developers choose phpspy because it offers production-safe profiling with near-zero overhead, supports multiple PHP SAPIs out of the box, and requires no application changes—making it uniquely suitable for troubleshooting performance issues in real-world deployments.
low-overhead sampling profiler for PHP 7+
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Profiles PHP applications without any code changes or extensions, as emphasized in the key features, enabling safe, non-disruptive use in production environments.
Works seamlessly with CLI, Apache mod_php, and PHP-FPM, demonstrated in the synopsis and demos for attaching to various process types without configuration.
Can attach to running PHP processes in real-time using -p or -P options, shown in the attach GIFs, allowing dynamic troubleshooting without restarting services.
Outputs stack traces compatible with FlameGraph scripts, with a clear example in the synopsis for creating visual performance analysis SVG files.
Designed for low-impact sampling with configurable rates (-H), as stated in the philosophy, making it suitable for production without significant performance degradation.
Limited to 64-bit Linux and often requires sudo for process attachment, restricting use in cross-platform or containerized environments without elevated privileges.
As a sampling profiler, it provides approximate traces that may miss brief function calls, unlike instrumented tools like Xdebug that capture every execution path.
Requires compilation with make, and using Zend structs (USE_ZEND=1) needs PHP development headers, adding setup steps compared to pre-built commercial alternatives.
Options like variable peeking (-e) are marked experimental and may be unreliable, and known bugs exist for edge cases, as admitted in the README's known bugs section.
PHPSpy is an open-source alternative to the following products:
Blackfire is a performance management platform that helps developers profile, test, and monitor the performance of their PHP applications.
Tideways is an application performance monitoring (APM) tool for PHP applications that provides profiling, tracing, and error tracking to optimize performance.