Runtime Diagnostics
PHP 500 Error Debugging Guide
Trace PHP HTTP 500 responses through the reverse proxy, PHP-FPM pool, application logs, runtime configuration and failing request context. This reference is written for developers who need practical validation behavior, reviewable rules and safe examples rather than copied snippets with no explanation.
Recommended workflow
| Step | Why it matters |
|---|---|
| Preserve the failing request | Record route, method, timestamp and correlation ID without copying credentials or personal data. |
| Check the proxy layer | Separate upstream connection failures from application-generated 500 responses. |
| Follow PHP-FPM | Review pool logs, worker limits, timeouts and the effective php.ini for the serving process. |
| Reproduce safely | Use a non-production request with the same code path and controlled input. |
Starter snippet
request id -> web server log -> PHP-FPM log -> application exceptionReview checks
- Keep display_errors off in production.
- Log a safe correlation ID in every layer.
- Check disk space and file permissions.
- Verify opcache state after deployment.
Common mistakes
- Showing stack traces to public clients.
- Editing CLI php.ini while PHP-FPM uses another file.
- Restarting every service before collecting evidence.
Validation should help users correct input while protecting systems from bad data. Keep syntax checks, product policy, security review and deliverability checks separate.
Related Formalint references
Continue with Php Fpm Nginx Debugging Guide, Nginx 502 504 Debugging Guide, Php Ini Configuration Guide.