4

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.

4
  • How are the strings getting truncated, at which position? Can you show an example? Commented Sep 29, 2013 at 23:46
  • Have you restarted your php processes (probably the http server or the fcgi container)? Only then the changed php.ini file is reloaded. Commented Sep 29, 2013 at 23:50
  • I've restarted it php-fpm and see the changes added by calling phpinfo() and the problem still persists. Commented Sep 30, 2013 at 1:22
  • Where are you telling php to send the errors? Commented Dec 19, 2014 at 21:40

2 Answers 2

8

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Sorry, I forgot to mention that nginx and php-fpm is installed on a Mac OS X via homebrew.
2

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/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.