Project

General

Profile

[Solved] How to debug fastcgi side error?

Added by roytam1 almost 7 years ago

I have a FreeBSD + lighttpd-1.4.44 + PHP-pfm 5.3.x server and php is updated to 5.6.29 today.
And now I hit "2017-05-18 00:00:33: (mod_fastcgi.c.2478) response headers too large for /myphp.php" (and HTTP 502 in browser) which never happen before. I want to debug it but where should I start?

PHP error log and fpm log shows nothing about it.


Replies (3)

RE: How to debug fastcgi side error? - Added by gstrauss almost 7 years ago

2017-05-18 00:00:33: (mod_fastcgi.c.2478) response headers too large for /myphp.php

That error trace is from lighttpd, not from your PHP.

The error message for mod_fastcgi.c line 2478 in lighttpd 1.4.44 indicates that your PHP is sending response headers > 32k. That is a lot of data in response headers, which in many cases (but not all) is either suboptimal or wrong. Unfortunately, that value of 32k for response headers from dynamic handlers is hard-coded into lighttpd, so you need to fix your PHP.

How to debug fastcgi side error?

See the docs: Docs_ModFastCGI, but the error message is fairly precise, so I am not sure what else you would be looking for.

RE: [Solved] How to debug fastcgi side error? - Added by roytam1 almost 7 years ago

That is a lot of data in response headers, which in many cases (but not all) is either suboptimal or wrong. Unfortunately, that value of 32k for response headers from dynamic handlers is hard-coded into lighttpd, so you need to fix your PHP.

I knew that but what I want is dumping what php-fpm output to see whats the content of header so I can debug on that side, and fastcgi.debug doesn't seem to do such job here.

RE: [Solved] How to debug fastcgi side error? - Added by gstrauss almost 7 years ago

strace -o /tmp/strace-lighttpd.log -s 32768 -p "pidof-lighttpd"
(replace "pidof-lighttpd" with the PID of the lighttpd process) and look at what is received from the backend after making a request. (Since the response is so large, I recommend sending the strace output to a log file. Note that the FastCGI protocol contains some binary, so the strace will show the FastCGI packets. Still, most of what you see will be text.
less -n /tmp/strace-lighttpd.log
to view the output after you start strace, send your request, and then kill strace with Ctrl-C.
    (1-3/3)