简体   繁体   中英

PHP Nginx error_log getting truncated

I'm running nginx and PHP 5.5 and all my error_log messages are getting truncated when the string that's passed is long.

I've updated my php.ini file and increased the log max length from 1024 to 0 (no maximum) and it's still happening.

You need to recompile Nginx if you want log lines longer than 2048 bytes. From http://wiki.nginx.org/HttpLuaModule :

There is a hard-coded length limitation on the error messages in the Nginx core. It is 2048 bytes at most, including the trailing newlines and the leading timestamps. You can manually modify this limit by modifying the NGX_MAX_ERROR_STR macro definition in the src/core/ngx_log.h file in the Nginx source tree. If the message size exceeds this limit, the Nginx core will truncate the message text automatically.

The 1024 character limit is hard-coded in php-fpm and you will need to re-compile it.

If you want to go over 2048 characters you will need to re-compile nginx too.

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

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