bkdotcom / PHPDebugConsole

Browser/javascript-like logger/console class for PHP
http://www.bradkent.com/php/debug
Other
78 stars 4 forks source link

Request Headers problem with php 8.1.15 #55

Closed rgilsimoes closed 1 week ago

rgilsimoes commented 1 year ago

After a lot of testing I believe there is a problem when using php 8.1.15. When setting route to "chromeLogger" and enabling requestHeadersOutput there is always this sequence of errors:

[proxy_fcgi:error] [pid 47499:tid 140439541749504] [client ... ] Premature end of script headers: report_novos_cartoes.php, referer: https://www......eu/.../ [proxy_fcgi:error] [pid 47499:tid 140439541749504] [client ... ] AH01070: Error parsing script headers, referer: https://www....eu/.../

I messed with a lot of buffer sizes and so on, but the only solution was to change to php 8.0.23 and now it is working.

bkdotcom commented 1 year ago

I will investigate, but this smells like the headers grew too big for the proxy server Have you tried ServerLog (http://bradkent.com/php/debug#routeServerLog)

it seems to have been created to address the header size limitations of ChromeLogger...

Essentially the log is written to a json file.. a url to that file is output in the response headers.. A browser plugin then requests the log.

rgilsimoes commented 1 year ago

Hi @bkdotcom ! I've tried ServerLog but could not get any output from the browser plugin :-/ not too much info about it also.

As far as the size limitations what I've also found was that when setting the max Header Size on bdkDebug the ChromeLogger yields an error saying it could not allocate X Kb for logging.

bkdotcom commented 1 year ago

I have updated the documentation for configuring ServerLog output https://www.bradkent.com/php/debug#routeServerLog

Let me know if that clarifies how to get it up and running

rgilsimoes commented 1 year ago

Hello @bkdotcom! I've tried both Server Log chrome extensions and found out the following: This "ServerLog" extension https://chrome.google.com/webstore/detail/server-log/lophlnbmepajcpfhafaciibembckdpih works fine when you open the related dev panel.

As this "Server Log" extension https://chrome.google.com/webstore/detail/serverlog/ghmhlknahaejhdlobgpaoocmjlhgmcci does not work because it asks for a "key" in order to authenticate to the server.

I've tried added the same key to both php Debug and the extension but it does not seem to work.

bkdotcom commented 1 year ago

the "key"used in the 2nd extension is unrelated to PHPDebugConsole's key... I haven't installed the extension, but it appears it may be optional and used in conjunction with a server-side library by the same author.. the extension passes its key as a x-request-server-log header and his server-side logger checks that value before writing to a log file..

(if the key is required, any value should work with PHPDebugConsole.. as it's doesn't care about it)

That said, I'd recommend the extension that's the easiest to use.

At some point I'd like to try writing my own extension that supports both ServerLog and ChromeLogger and simply writes to the primary console tab...

I will investigate the "could not allocate X Kb for logging" chromelogger issue...

Were you able to get something to work?

bkdotcom commented 2 weeks ago

I'm going to close this issue soon as It seems to be server configuration related

did you have any luck with it?

perhaps fast-cgi related?

I did find these "articles" regarding "Premature end of script headers" :