Apache Internal error with send headers > 8Kb, for example: function randomPassword($len) { $alphabet = "abcdefghijklmnopqrstuwxyzABCDEFGHIJKLMNOPQRSTUWXYZ0123456789"; for ($i = 0; $i < $len; $i++) { $n = rand(0, count($alphabet)-1); $pass .= $alphabet[$n]; } return $pass; } setcookie("test", randomPassword(8173)); And this code OK: function randomPassword($len) { $alphabet = "abcdefghijklmnopqrstuwxyzABCDEFGHIJKLMNOPQRSTUWXYZ0123456789"; for ($i = 0; $i < $len; $i++) { $n = rand(0, count($alphabet)-1); $pass .= $alphabet[$n]; } return $pass; } setcookie("test", randomPassword(8172)); Difference in one byte. Please, check.
This is a restriction imposed by the core APIs which modules like mod_fcgid use to read the response header (ap_scan_script_header_err_core() and friends).
(In reply to Jeff Trawick from comment #1) > This is a restriction imposed by the core APIs which modules like mod_fcgid > use to read the response header (ap_scan_script_header_err_core() and > friends). You can fix this? How?
>You can fix this? How? It may be possible to recompile everything with a bigger MAX_STRING_LEN, but I can't confirm that. The right solution seems to be new APIs in httpd core, and changes to modules like mod_fcgid to use the new APIs. The new APIs would respect user configuration of higher limits for script header size, just as the LimitRequestFieldSize directive controls something similar for client request headers.
#define MAX_STRING_LEN 256(In reply to Jeff Trawick from comment #3) How much increase? LimitRequestFieldSize present in Apache 2.2, but does not help :( > >You can fix this? How? > > It may be possible to recompile everything with a bigger MAX_STRING_LEN, but > I can't confirm that. > > The right solution seems to be new APIs in httpd core, and changes to > modules like mod_fcgid to use the new APIs. The new APIs would respect user > configuration of higher limits for script header size, just as the > LimitRequestFieldSize directive controls something similar for client > request headers.
>define MAX_STRING_LEN 256 That's the definition in a couple of utility programs. It would need to be edited in httpd.h to be larger than 8192. It is probably less risky to keep MAX_STRING_LEN and HUGE_STRING_LEN equivalent, so /* old value: #define HUGE_STRING_LEN 8192 */ #define HUGE_STRING_LEN 10000 10000 assumes that your cookies aren't so big. You'd have to recompile all of httpd, mod_fcgid, and any other third-party modules that use HUGE_STRING_LEN. And I'm not sure if it would all work. Perhaps you can reduce the size of your cookie.
Yes, this solved problem. Thanks! (In reply to Jeff Trawick from comment #5) > >define MAX_STRING_LEN 256 > > That's the definition in a couple of utility programs. > > It would need to be edited in httpd.h to be larger than 8192. It is > probably less risky to keep MAX_STRING_LEN and HUGE_STRING_LEN equivalent, so > > /* old value: #define HUGE_STRING_LEN 8192 */ > #define HUGE_STRING_LEN 10000 > > 10000 assumes that your cookies aren't so big. > > You'd have to recompile all of httpd, mod_fcgid, and any other third-party > modules that use HUGE_STRING_LEN. And I'm not sure if it would all work. > > Perhaps you can reduce the size of your cookie.
Let's leave this open to track a better solution in the future. Many users, such as those that obtain httpd from the OS, aren't able to recompile everything.