Nginx

fastcgi php nginx 錯誤日誌搞砸了

  • March 26, 2020

我有一個奇怪的問題,我的 nginx 伺服器的錯誤日誌不知何故搞砸了:PHP 錯誤似乎都寫在一行中並遞歸地重複。這樣,llog 在一天內就增長了幾 GB!

這是錯誤日誌中的一行:

2020/03/26 16:58:45 [error] 29816#29816: *32 FastCGI sent in stderr: "PHP message: PHP Notice:  Undefined variable: SCRIPT_FILENAME in /var/kunden/webs/my_web_app/www/pics/userpics/index.php on line 58PHP message: PHP Notice:  Undefined variable: pfad in /var/kunden/webs/my_web_app/www/pics/userpics/index.php on line 60PHP message: PHP Notice:  Undefined offset: 1 in /var/kunden/webs/my_web_app/www/pics/userpics/index.php on line 65PHP message: PHP Notice:  Undefined variable: benutzer in /var/kunden/webs/my_web_app/www/pics/userpics/index.php on line 70PHP message: PHP Notice:  Undefined index: PATH_TRANSLATED in /var/kunden/webs/my_web_app/www/pics/userpics/index.php on line 84PHP message: PHP Notice:  Undefined variable: localdir in /var/kunden/webs/my_web_app/www/pics/userpics/index.php on line 96PHP message: PHP Notice:  Undefined variable: localdir in /var/kunden/webs/my_web_app/www/pics/userpics/index.php on line 96PHP message: PHP Notice:  Undefined variable: localdir in /var/kunden/webs/my_web_app/www/pics/userpics/index.php on line 96PHP message: PHP Notice:  Undefined variable: localdir in /var/kunden/webs/my_web_app/www/pics/userpics/index.php on line 96PHP message: PHP Notice:  Undefined variable: localdir in /var/kunden/webs/my_web_app/www/pics/userpics/index.php on line 96PHP message: PHP Notice:  Undefined variable: localdir in /var/kunden/webs/my_web_app/www/pics/userpics/index.php on line 96PHP message: PHP Notice:  Undefined variable: localdir in /var/kunden/webs/my_web_app/www/pics/userpics/index.php on line 96PHP message: PHP Notice:  Undefined variable: localdir in /var/kunden/webs/my_web_app/www/pics/userpics/index.php on line 96PHP message: PHP Notice:  Undefined variable: localdir in /var/kunden/webs/my_web_app/www/pics/userpics/index.php on line 96PHP message: PHP Notice:  Undefined variable: localdir in /var/kunden/webs/my_web_app/www/pics/userpics/index.php on line 96PHP message: PHP Notice:  Undefined variable: localdir in /var/kunden/webs/my_web_app/www/pics/userpics/index.php on li

這些行在 2048 個字元後被剪切。

在這裡,我在每個新錯誤之前拆分行:


2020/03/26 16:58:45 [error] 29816#29816: *32 FastCGI sent in stderr: "
PHP message: PHP Notice:  Undefined variable: SCRIPT_FILENAME in /var/kunden/webs/my_web_app/www/pics/userpics/index.php on line 58
PHP message: PHP Notice:  Undefined variable: pfad in /var/kunden/webs/my_web_app/www/pics/userpics/index.php on line 60
PHP message: PHP Notice:  Undefined offset: 1 in /var/kunden/webs/my_web_app/www/pics/userpics/index.php on line 65
PHP message: PHP Notice:  Undefined variable: benutzer in /var/kunden/webs/my_web_app/www/pics/userpics/index.php on line 70
PHP message: PHP Notice:  Undefined index: PATH_TRANSLATED in /var/kunden/webs/my_web_app/www/pics/userpics/index.php on line 84
PHP message: PHP Notice:  Undefined variable: localdir in /var/kunden/webs/my_web_app/www/pics/userpics/index.php on line 96
PHP message: PHP Notice:  Undefined variable: localdir in /var/kunden/webs/my_web_app/www/pics/userpics/index.php on line 96
PHP message: PHP Notice:  Undefined variable: localdir in /var/kunden/webs/my_web_app/www/pics/userpics/index.php on line 96
PHP message: PHP Notice:  Undefined variable: localdir in /var/kunden/webs/my_web_app/www/pics/userpics/index.php on line 96
PHP message: PHP Notice:  Undefined variable: localdir in /var/kunden/webs/my_web_app/www/pics/userpics/index.php on line 96
PHP message: PHP Notice:  Undefined variable: localdir in /var/kunden/webs/my_web_app/www/pics/userpics/index.php on line 96
PHP message: PHP Notice:  Undefined variable: localdir in /var/kunden/webs/my_web_app/www/pics/userpics/index.php on line 96
PHP message: PHP Notice:  Undefined variable: localdir in /var/kunden/webs/my_web_app/www/pics/userpics/index.php on line 96
PHP message: PHP Notice:  Undefined variable: localdir in /var/kunden/webs/my_web_app/www/pics/userpics/index.php on line 96
PHP message: PHP Notice:  Undefined variable: localdir in /var/kunden/webs/my_web_app/www/pics/userpics/index.php on line 96
PHP message: PHP Notice:  Undefined variable: localdir in /var/kunden/webs/my_web_app/www/pics/userpics/index.php on li

這可能來自哪裡?如何在 nginx 中定義標準錯誤報告?

似乎帶有 fastcgi 的 nginx 捆綁了所有錯誤,這些錯誤發生在一行消息的一頁上。

如果腳本有很多錯誤(可能是由於 PHP 升級),那麼該行將被截斷為 2048 個字元。

引用自:https://unix.stackexchange.com/questions/575128