What the message looks like
PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in /var/www/site/vendor/autoload_real.php on line 41Common causes
- PHP fatal error, e.g. “Allowed memory size … exhausted” or an undefined function after an update.
- Missing PHP extension after switching PHP versions.
- The application cannot write to cache, log or upload directories.
- Rewrite loop in nginx (“rewrite or internal redirection cycle”).
- Database unreachable or credentials changed.
Check
- Show recent errors in the nginx error.log
tail -n 50 /var/log/nginx/error.log - Show PHP-FPM messages from the last minutes
journalctl -u 'php*-fpm' --since '15 min ago' --no-pager | tail -n 30 - Search the PHP-FPM log for fatal errors
grep -i 'fatal' /var/log/php*-fpm.log | tail -n 10 - Fetch the status code reproducibly
curl -sS -o /dev/null -w '%{http_code}\n' https://example.com/
Fix
- Read the first error at the time of the request – it names file and line.
- For memory errors raise
memory_limitin the pool or php.ini deliberately, not blanket -1. - Install missing modules (e.g.
php8.3-intl) and restart PHP-FPM. - Give the PHP-FPM user write access to cache and log directories.
- After a failed update roll back to the last working version and analyse calmly.
FAQ
Should I turn on display_errors?
Not in production. Errors in the browser leak paths and credentials. Keep log_errors = On and read the log.
Why is there nothing in the nginx log?
Then PHP handled the error itself and only returned 500. Check the application log or the PHP-FPM log with catch_workers_output = yes.