簡體   English   中英

NGINX / PHP7.4-FPM 在沒有啟用錯誤報告的情況下拋出 502

[英]NGINX / PHP7.4-FPM throws 502 without error_reporting enabled

昨天我偶然發現了一個奇怪的問題。 突然,一個特定的 PHP 腳本不再起作用,它引發了 502 錯誤。 當我啟用 error_reporting 時,只顯示通知/警告,但頁面的 rest 正在正確呈現。 當我禁用error_reporting("E_ALL"); ini_set("display_errors", 1); error_reporting("E_ALL"); ini_set("display_errors", 1); 再次,NGINX 再次拋出 502。

奇怪的是,當我使用以下代碼段捕獲通知/警告時:

function myErrorHandler($errno, $errstr, $errfile, $errline)
{
    if ($errno == E_USER_NOTICE){
    }
}

set_error_handler("myErrorHandler");

頁面也正確呈現,顯然沒有顯示錯誤。

Debian 版本:4.9.0-6-amd64 #1 SMP Debian 4.9.88-1+deb9u1 (2018-05-07) x86_64

PHP 版本:php7.4-fpm

NGINX 版本:nginx/1.10.3

這可能是 memory 問題嗎? 或者有人有另一種解釋,為什么會這樣?

該代碼沒有設置響應 header 因為我從未在某處設置任何標題。 我也不使用錯誤處理程序,我只是在某些東西不起作用時激活 error_reporting。 如果一切正常,我會禁用 display_errors,因此不會顯示通知/警告。

如果我刪除文件的以下行,它也可以在不捕獲錯誤的情況下工作: $list = $tn->getMassnahmen();

$tn 是我的 class 'teilnehmer' 的一個實例: $tn = new teilnehmer;

'getMassnahmen' 的代碼:

    function getMassnahmen()
    {
        $stmt = $this->db->prepare('SELECT * FROM `massnahmen_txt` ORDER BY `id` ASC');
        if ($stmt->execute()) {
            while ($row = $stmt->fetch()) {
                $result[] = $row;
            }
        }

        return $result;
    }

'teilnehmer' 是我的客戶。 客戶端可以添加文件(不同的數據庫表)。 只有在客戶端添加了文件時,才會以某種方式出現錯誤。 如果我在我的代碼中注釋掉有關文件的整個部分,錯誤仍然會發生。 僅刪除行$list = $tn->getMassnahmen(); 會有所幫助。 但是這條線與文件沒有任何關系。 他們只使用相同的 class。

class / 'teilnehmer' ($tn) 的實例之前在代碼中被多次使用,沒有任何錯誤。

錯誤日志:

Notice:  Undefined variable: nocal in /PATH//html/inc/global.inc.php on line 34
Notice:  Undefined variable: result in /PATH//html/classes/user.php on line 672
Warning:  sizeof(): Parameter must be an array or an object that implements Countable in /PATH//html/inc/global.inc.php on line 57
Notice:  Undefined variable: newdates in /PATH//html/inc/global.inc.php on line 101
Warning:  sizeof(): Parameter must be an array or an object that implements Countable in /PATH//html/inc/global.inc.php on line 101
Notice:  Undefined variable: list in /PATH//html/inc/global.inc.php on line 113
Notice:  Undefined variable: is_index in /PATH//html/inc/global.inc.php on line 120
Notice:  Undefined variable: result in /PATH//html/classes/user.php on line 898
Warning:  sizeof(): Parameter must be an array or an object that implements Countable in /PATH//html/inc/global.inc.php on line 129
Notice:  Undefined variable: calendar in /PATH//html/inc/global.inc.php on line 133
Notice:  Undefined variable: result in /PATH//html/classes/user.php on line 898
Notice:  Undefined variable: result in /PATH//html/classes/mandanten.php on line 48
Warning:  sizeof(): Parameter must be an array or an object that implements Countable in /PATH//html/inc/global.inc.php on line 144
Notice:  Undefined variable: result in /PATH//html/classes/user.php on line 1425
Warning:  sizeof(): Parameter must be an array or an object that implements Countable in /PATH//html/inc/global.inc.php on line 190
Warning:  array_walk() expects parameter 2 to be a valid callback, class 'user' does not have a method 'htmlspecialcharsArray' in /PATH//html/classes/user.php on line 224
Warning:  array_walk() expects parameter 2 to be a valid callback, class 'user' does not have a method 'htmlspecialcharsArray' in /PATH//html/classes/user.php on line 224
Warning:  array_walk() expects parameter 2 to be a valid callback, class 'user' does not have a method 'htmlspecialcharsArray' in /PATH//html/classes/user.php on line 224
Warning:  array_walk() expects parameter 2 to be a valid callback, class 'user' does not have a method 'htmlspecialcharsArray' in /PATH//html/classes/user.php on line 224
Warning:  array_walk() expects parameter 2 to be a valid callback, class 'user' does not have a method 'htmlspecialcharsArray' in /PATH//html/classes/user.php on line 224
Warning:  array_walk() expects parameter 2 to be a valid callback, class 'user' does not have a method 'htmlspecialcharsArray' in /PATH//html/classes/user.php on line 224
Warning:  array_walk() expects parameter 2 to be a valid callback, class 'user' does not have a method 'htmlspecialcharsArray' in /PATH//html/classes/user.php on line 224
Warning:  array_walk() expects parameter 2 to be a valid callback, class 'user' does not have a method 'htmlspecialcharsArray' in /PATH//html/classes/user.php on line 224
Warning:  array_walk() expects parameter 2 to be a valid callback, class 'user' does not have a method 'htmlspecialcharsArray' in /PATH//html/classes/user.php on line 224
Warning:  array_walk() expects parameter 2 to be a valid callback, class 'user' does not have a method 'htmlspecialcharsArray' in /PATH//html/classes/user.php on line 224
Warning:  array_walk() expects parameter 2 to be a valid callback, class 'user' does not have a method 'htmlspecialcharsArray' in /PATH//html/classes/user.php on line 224
Warning:  array_walk() expects parameter 2 to be a valid callback, class 'user' does not have a method 'htmlspecialcharsArray' in /PATH//html/classes/user.php on line 224
Warning:  array_walk() expects parameter 2 to be a valid callback, class 'user' does not have a method 'htmlspecialcharsArray' in /PATH//html/classes/user.php on line 224
Warning:  array_walk() expects parameter 2 to be a valid callback, class 'user' does not have a method 'htmlspecialcharsArray' in /PATH//html/classes/user.php on line 224
Warning:  array_walk() expects parameter 2 to be a valid callback, class 'user' does not have a method 'htmlspecialcharsArray' in /PATH//html/classes/user.php on line 224
Notice:  Undefined index: success in /PATH//html/teilnehmer_edit.php on line 17
Notice:  Undefined index: removedfile in /PATH//html/teilnehmer_edit.php on line 21
Notice:  Undefined index: successremovelog in /PATH//html/teilnehmer_edit.php on line 26
Notice:  Undefined index: fehltag_add in /PATH//html/teilnehmer_edit.php on line 65
Notice:  Undefined index: remove_fehltag in /PATH//html/teilnehmer_edit.php on line 142
Notice:  Undefined variable: content in /PATH//html/teilnehmer_edit.php on line 248
Notice:  Undefined variable: active_fehltage in /PATH//html/teilnehmer_edit.php on line 257
Notice:  Undefined variable: kursdata in /PATH//html/teilnehmer_edit.php on line 281
Notice:  Undefined variable: statusdata in /PATH//html/teilnehmer_edit.php on line 282
Notice:  Undefined variable: tabledata in /PATH//html/classes/template.php on line 134
Notice:  Undefined variable: result in /PATH//html/classes/teilnehmer.php on line 606
Warning:  sizeof(): Parameter must be an array or an object that implements Countable in /PATH//html/teilnehmer_edit.php on line 300
Warning:  sizeof(): Parameter must be an array or an object that implements Countable in /PATH//html/teilnehmer_edit.php on line 314
Notice:  Undefined variable: filelist in /PATH//html/teilnehmer_edit.php on line 387
Notice:  Undefined variable: fehlliste in /PATH//html/teilnehmer_edit.php on line 676
Notice:  Trying to access array offset on value of type bool in /PATH//html/teilnehmer_edit.php on line 699
Notice:  Undefined variable: aglist in /PATH//html/teilnehmer_edit.php on line 740
Notice:  Undefined index: name in /PATH//html/teilnehmer_edit.php on line 742
Notice:  Undefined index: name in /PATH//html/teilnehmer_edit.php on line 742
Notice:  Undefined variable: result in /PATH//html/classes/teilnehmer.php on line 684
Warning:  sizeof(): Parameter must be an array or an object that implements Countable in /PATH//html/teilnehmer_edit.php on line 752
Notice:  Undefined variable: list1 in /PATH//html/teilnehmer_edit.php on line 776
Notice:  Undefined variable: mlist in /PATH//html/teilnehmer_edit.php on line 796

在此先感謝您的幫助!

設置后

fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;

在我的 nginx 配置中,問題已解決。 似乎 fastcgi 的緩沖區大小不足以響應響應。 非常感謝你的幫助!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM