简体   繁体   中英

Truncated PHP-FPM / NGINX log lines

I have a lot of lines in my PHP-FPM / NGINX logs that are truncated to 2048 bytes like this:

2022/05/15 16:06:16 [error] 899#899: *29892 FastCGI sent in stderr: "com/wordpress/wp-includes/class-wp-query.php on line 4121PHP message: PHP Warning:  Attempt to read property "post_title" on null in /var/www/ultimatehackingkeyboard.com/wordpress/wp-includes/class-wp-qu
ery.php on line 4123PHP message: PHP Warning:  Attempt to read property "post_name" on null in /var/www/ultimatehackingkeyboard.com/wordpress/wp-includes/class-wp-query.php on line 4125PHP message: PHP Warning:  Attempt to read property "ID" on null in /var/www/ultimateha
ckingkeyboard.com/wordpress/wp-includes/class-wp-query.php on line 4121PHP message: PHP Warning:  Attempt to read property "post_title" on null in /var/www/ultimatehackingkeyboard.com/wordpress/wp-includes/class-wp-query.php on line 4123PHP message: PHP Warning:  Attempt 
to read property "post_name" on null in /var/www/ultimatehackingkeyboard.com/wordpress/wp-includes/class-wp-query.php on line 4125PHP message: PHP Warning:  Attempt to read property "ID" on null in /var/www/ultimatehackingkeyboard.com/wordpress/wp-includes/class-wp-query.
php on line 4121PHP message: PHP Warning:  Attempt to read property "post_title" on null in /var/www/ultimatehackingkeyboard.com/wordpress/wp-includes/class-wp-query.php on line 4123PHP message: PHP Warning:  Attempt to read property "post_name" on null in /var/www/ultima
tehackingkeyboard.com/wordpress/wp-includes/class-wp-query.php on line 4125PHP message: PHP Warning:  Attempt to read property "ID" on null in /var/www/ultimatehackingkeyboard.com/wordpress/wp-includes/class-wp-query.php on line 4121PHP message: PHP Warning:  Attempt to r
ead property "post_title" on null in /var/www/ultimatehackingkeyboard.com/wordpress/wp-includes/class-wp-query.php on line 4123PHP message: PHP Warning:  Attempt to read property "post_name" on null in /var/www/ultimatehackingkeyboard.com/wordpress/wp-includes/class-wp-qu
ery.php on line 4125PHP message: PHP Warning:  Attempt to read property "ID" on null in /var/www/ultimatehackingkeyboard.com/wordpress/wp-inclu

I've read many similar issues, and some people suggest recompiling NGINX, but I can't believe there's no other solution.

I've set the following options, which, to my knowledge, should solve the issue, but they don't:

  • log_errors_max_len = 8000 in /etc/php/8.0/fpm/php.ini .
  • log_limit = 8000 in /etc/php/8.0/fpm/php-fpm.conf .
  • decorate_workers_output = no in /etc/php/8.0/fpm/pool.d/www.conf

The limit of 1024 characters is hard-coded in php-fpm not nginx.

If you want to go over 2048 characters you need to re-compiled both nginx and php-fpm, else only php-fpm.

There is a full solution with patches here for 8192 characters: https://forums.freebsd.org/threads/56543/

You can change the logging settings in the config so that, instead of errors being printed to STDERR and percolating through the various intervening layers with their own constraints, the errors are written directly to a file by PHP.

The config directive is simply:

error_log = /path/to/file

Ref: https://www.php.net/manual/en/errorfunc.configuration.php#ini.error-log

You can send error logs to stdout and log there with additional software.

www.conf

php_admin_value[error_log] = /dev/stdout
catch_workers_output = yes

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM