PHP monitoring and APM for Laravel and Symfony
Install the OpenTelemetry PHP extension and Obseria traces every Laravel or Symfony request, every SQL query and HTTP call, and shows whether PHP-FPM has enough workers.


Why monitor PHP with Obseria
Auto-instrumentation via extension
The opentelemetry PECL extension hooks into framework and library functions, so Composer packages add spans without code changes.
Code and capacity together
Traces show slow controllers and queries, while PHP-FPM metrics show whether requests wait for a free worker.
Errors with context
Exceptions are recorded on spans with stack trace, route and release, so a new error after a deploy is easy to trace back.
PHP frameworks and libraries Obseria monitors
- Laravel. Routes, controllers, queued jobs, Eloquent queries and cache calls appear as spans with route templates.
- Symfony. HttpKernel, HttpClient and Messenger are instrumented, giving server spans per route plus client and message spans.
- PDO, MySQLi and Doctrine. Every database statement becomes a client span with duration, ready for slow-query analysis.
- Guzzle, cURL and PSR-18 clients. Outbound HTTP calls propagate W3C trace context to downstream services.
- Slim, WordPress and other frameworks. Further OpenTelemetry contrib packages cover Slim, WordPress, CakePHP, Yii, Magento and PSR-15 middleware.
- PHP-FPM. Pool metrics from the FPM status page show active and idle workers, queued connections and slow requests.
The PHP signals that matter
Obseria collects these values automatically and shows them in ready-made dashboards and alerts.Worker availability
Shows whether enough workers are free to handle visitors, or whether the website is running at its limit.
Waiting visitors
Tells you how many requests are waiting in line and how much traffic your website accepts over time.
Page speed
Reveals how long pages take to build and how often a request is slower than your agreed limit.
Resource use per request
Shows how much memory and processing power each request needs, pointing to pages that are expensive to serve.
Show all 9 metrics in detail
| Metric | Unit | What it tells you |
|---|---|---|
phpfpm_active_processes | {process} | Workers currently serving requests; close to pm.max_children means the pool is saturated. |
phpfpm_idle_processes | {process} | Workers waiting for requests, your remaining headroom. |
phpfpm_listen_queue | {connection} | Requests waiting for a free worker; any sustained value adds latency. |
phpfpm_max_children_reached | {event} | How often FPM hit the worker limit and could not start more processes. |
phpfpm_slow_requests | {request} | Requests that exceeded request_slowlog_timeout, a direct pointer to slow code paths. |
phpfpm_accepted_connections | {connection} | Requests accepted by the pool, the basis for throughput. |
phpfpm_process_request_duration | us | Duration of each worker's current or last request. |
phpfpm_process_last_request_memory | By | Peak memory of each worker's last request, to spot memory-hungry endpoints. |
phpfpm_process_last_request_cpu | % | CPU usage of each worker's last request. |
Set up PHP monitoring in minutes
- Step 1
Install the extension
Install the opentelemetry extension with PECL, pickle or install-php-extensions and enable it in php.ini (PHP 8.0 or newer).
- Step 2
Add Composer packages
Require the SDK, the OTLP exporter and the auto-instrumentation packages for your framework and libraries.
- Step 3
Configure and scrape FPM
Set OTEL_PHP_AUTOLOAD_ENABLED and the OTLP variables, and expose the PHP-FPM status page for a Prometheus exporter that Obseria scrapes.
# 1. Install the OpenTelemetry extension and enable it in php.ini
pecl install opentelemetry
echo "extension=opentelemetry.so" > "$(php-config --ini-dir)/opentelemetry.ini"
# 2. Add SDK, OTLP exporter and auto-instrumentation packages
composer require open-telemetry/sdk open-telemetry/exporter-otlp \
open-telemetry/opentelemetry-auto-laravel \
open-telemetry/opentelemetry-auto-pdo \
open-telemetry/opentelemetry-auto-guzzle
# 3. Configure (for PHP-FPM, pass these via env[...] in the pool config)
export OTEL_PHP_AUTOLOAD_ENABLED=true
export OTEL_SERVICE_NAME="shop-backend"
export OTEL_TRACES_EXPORTER=otlp
export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
export OTEL_EXPORTER_OTLP_ENDPOINT="${OBSERIA_OTLP_ENDPOINT}"
export OTEL_EXPORTER_OTLP_HEADERS="Authorization=Bearer%20${OBSERIA_TOKEN}"
export OTEL_PROPAGATORS=baggage,tracecontextOut of the box
Dashboards, alerts and SLOs that are ready the moment data arrives.
- PHP service health with RED metrics per route
- PHP-FPM pools: active, idle and queued workers
- Alert on listen queue above zero for 5 minutes
- Alert on new exception types after deploy
- Slowest SQL statements by endpoint
PHP monitoring: what matters
Why PHP monitoring matters
PHP runs a large part of the web: e-commerce shops, content platforms, customer portals and APIs built with Laravel and Symfony. The execution model is simple, one request per worker process, but that simplicity hides two very different failure modes. Either the code is slow, because of a heavy query or an external API, or the pool of PHP-FPM workers is full and requests wait before any PHP code runs. PHP monitoring has to cover both, or teams end up optimizing code when the real problem is capacity, or the other way around.
OpenTelemetry PHP is stable for traces, metrics and logs. Auto-instrumentation relies on the opentelemetry PECL extension, which lets Composer packages hook into framework and library functions. With OTEL_PHP_AUTOLOAD_ENABLED=true, the SDK configures itself from environment variables, which makes PHP APM possible without changing application code.
Signals that matter for PHP performance monitoring
- Request latency and errors: server spans per route give rate, errors and duration. Exceptions recorded on spans show what broke and where.
- Database time: PDO and Doctrine spans show how much of each request is spent in SQL, and which statements dominate.
- External calls: Guzzle and cURL spans reveal slow payment, shipping or search APIs.
- Worker capacity:
phpfpm_active_processes,phpfpm_idle_processesandphpfpm_listen_queuetell you whether the pool keeps up with traffic.phpfpm_max_children_reachedcounts how often it hit the limit. - Slow and memory-hungry requests:
phpfpm_slow_requestsandphpfpm_process_last_request_memorypoint to endpoints that need attention.
Common PHP performance problems and how to detect them
Saturated PHP-FPM pools
When all workers are busy, new requests sit in the listen queue. Latency rises for every endpoint at once, while traces of individual requests look normal. A non-zero listen queue together with zero idle workers is the fingerprint.
N+1 queries in Eloquent and Doctrine
Lazy loading of relations issues one query per row. In the trace waterfall, dozens of nearly identical PDO spans under one request make the pattern obvious.
Slow third-party APIs
A synchronous call to an external service blocks the worker for its full duration. Client spans with high latency show the dependency, and fewer idle workers show the knock-on effect on capacity.
Memory limits
Large imports, reports or image processing can hit memory_limit and end in fatal errors. Per-request peak memory reveals which routes come close before users see errors.
Slow queue workers
Laravel queue workers and Symfony Messenger consumers run outside the web request, so their problems often stay hidden until emails, exports or webhooks arrive late. Spans for each processed job, with duration and failures per job class, show which background work slows down and whether it shares a database with the web tier.
Cold caches after deploys
After a release, OPcache and application caches are empty, and the first requests compile code and rebuild configuration. Comparing latency per release over the first minutes separates warm-up effects from real regressions.
Best practices for Laravel and Symfony monitoring
- Set
service.nameanddeployment.environment.nameper application, and separate web workers from queue workers. - Pass OTEL variables to PHP-FPM explicitly, for example with
env[...]entries in the pool configuration, because FPM clears the environment by default. - Install only the instrumentation packages you need to keep overhead and span volume low.
- Enable the FPM status page and slow log, and alert on queued requests rather than on CPU alone.
- Use tail-based sampling to keep every slow or failed request.
How Obseria helps with PHP APM
Obseria receives OpenTelemetry PHP traces over OTLP and scrapes PHP-FPM metrics through the Obseria Agent or the OpenTelemetry Collector. TopoGraph connects your PHP services with Nginx, MySQL, Redis and external APIs. When response times rise, Obseria Intelligence distinguishes between slow code, slow dependencies and exhausted worker pools and presents the root cause with its chain of evidence. Dashboards, alerts and SLOs are included, and all data stays exportable via OTLP.
Related capabilities
Distributed Tracing
Follow each request across services, queues and databases with OpenTelemetry-native distributed tracing, and find the slow span or failing dependency in seconds.
Learn moreError Tracking
The Errors Inbox groups exceptions from backend, frontend and mobile apps into issues, shows their impact and lets teams assign and resolve them in one workflow.
Learn moreDatabase Monitoring
Find the slow query behind a slow endpoint. Obseria links database metrics, query performance and logs to the traces and services that call them.
Learn moreLearn more
What is APM (application performance monitoring)?
What is APM? Learn how application performance monitoring measures latency, throughput and errors, how distributed tracing works, and which metrics matter.
What is OpenTelemetry?
What is OpenTelemetry? Learn how OTel's APIs, SDKs, Collector, OTLP and semantic conventions produce vendor-neutral traces, metrics, logs and profiles.
PHP monitoring FAQ
No. The opentelemetry extension plus auto-instrumentation packages for Laravel, Symfony, PDO or Guzzle create spans automatically. Manual spans through the OpenTelemetry API are optional.
OpenTelemetry auto-instrumentation for PHP requires PHP 8.0 or newer, the PECL extension and Composer autoloading. Individual packages may require newer PHP or framework versions.
PHP-FPM clears environment variables by default. Pass the OTEL_* variables with env[...] entries in the pool configuration, or set them in an ini file that PHP reads.
Enable the FPM status page and run a Prometheus exporter for PHP-FPM. The Obseria Agent or the OpenTelemetry Collector scrapes it, and the metrics appear next to your traces.
Yes. OpenTelemetry also provides a PHP distro for Linux, installed as a deb, rpm or apk package. Check its current status before rolling it out widely.
Start monitoring PHP today
Connect PHP in minutes with OpenTelemetry or the Obseria Agent. Free for 14 days.