Software⏱️ 3 min read📅 2026-06-11

How to Fix: NGINX, PHP-FPM - Error log entries missing line breaks

Error log entries missing line breaks in NGINX and PHP-FPM after version update.

Quick Answer: Check the PHP-FPM configuration file for the 'log_errors' directive, which controls whether error messages are logged with line breaks.

Error: Missing Line Breaks in PHP-FPM Error Logs

This issue affects users who have updated Nginx to version 1.19, replacing the older Ubuntu 18 repository version (1.14). The problem causes error log entries to be clumped together without line breaks, making it difficult to read and diagnose issues.

⚠️ Common Causes

  • The primary cause of this issue is the change in Nginx configuration due to the update from version 1.14 to 1.19. The new configuration may have introduced a setting that affects the formatting of PHP-FPM error logs.
  • An alternative reason for this issue could be related to changes in PHP-FPM's logging behavior or configurations, which might require additional investigation.

🔧 Proven Troubleshooting Steps

Enabling Line Breaks in PHP-FPM Error Logs

  1. Step 1: Edit the /etc/php/7.4/fpm/pool.d/*.conf files (or the corresponding version for your PHP version) to add the following line: `log_errors = On` and `display_errors = On`. This will enable error logging and display errors in a human-readable format.
  2. Step 2: Restart the PHP-FPM service to apply the changes: `sudo service php7.4-fpm restart` (or the corresponding command for your system).
  3. Step 3: Verify that the issue is resolved by checking the PHP-FPM error logs again.

Configuring Nginx to Format Error Logs with Line Breaks

  1. Step 1: Add the following configuration to your Nginx server block (e.g., /etc/nginx/sites-available/default): `error_log /var/log/php7.4-fpm.log;` and `log_format combined '$m %h $l $u $t %r %>s $b %{SSLLatency}ms %{Referer} %>s/$d'`. This will configure Nginx to format error logs with line breaks.
  2. Step 2: Restart the Nginx service to apply the changes: `sudo service nginx restart` (or the corresponding command for your system).
  3. Step 3: Verify that the issue is resolved by checking the PHP-FPM error logs again.

✨ Wrapping Up

To resolve the issue of missing line breaks in PHP-FPM error logs, you can either enable line breaks in PHP-FPM's logging behavior or configure Nginx to format error logs with line breaks. By following these steps and verifying the changes, you should be able to diagnose and troubleshoot issues more effectively.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions