Php

PHP 通過 FastCGI:“通過呼叫 exit() 終止”

  • December 2, 2012

我最近通過 mod_fcgid 設置將我的伺服器從 mod_php 設置轉換為 php。一切正常:它快速、簡單、不會崩潰等等等等。

我遇到的問題是日誌文件充滿了這樣的消息:

[Sat Nov 14 00:43:17 2009] [notice] mod_fcgid: process /var/www/fcgi-bin.d/php5-default/php-fcgi-wrapper(9451) exit(server exited), terminated by calling exit(), return code: 0
[Sat Nov 14 00:43:23 2009] [notice] mod_fcgid: process /var/www/fcgi-bin.d/php5-default/php-fcgi-wrapper(9453) exit(server exited), terminated by calling exit(), return code: 0
[Sat Nov 14 00:43:27 2009] [notice] mod_fcgid: process /var/www/fcgi-bin.d/php5-default/php-fcgi-wrapper(9457) exit(server exited), terminated by calling exit(), return code: 0
[Sat Nov 14 00:43:27 2009] [notice] mod_fcgid: process /var/www/fcgi-bin.d/php5-default/php-fcgi-wrapper(9459) exit(server exited), terminated by calling exit(), return code: 0
[Sat Nov 14 00:43:41 2009] [notice] mod_fcgid: process /var/www/fcgi-bin.d/php5-default/php-fcgi-wrapper(9463) exit(server exited), terminated by calling exit(), return code: 0
[Sat Nov 14 00:43:47 2009] [notice] mod_fcgid: process /var/www/fcgi-bin.d/php5-default/php-fcgi-wrapper(9461) exit(server exited), terminated by calling exit(), return code: 0
[Sat Nov 14 00:43:58 2009] [notice] mod_fcgid: process /var/www/fcgi-bin.d/php5-default/php-fcgi-wrapper(9466) exit(server exited), terminated by calling exit(), return code: 0

如果我的 apache2.conf 文件,我將日誌記錄設置為E_ALL & ~E_NOTICE. 我的 php.ini 文件設置為不記錄錯誤。

我確實exit在我的 php 程式碼中使用了該命令,但我不明白為什麼它會在日誌文件中引發通知。任何輸入將不勝感激。

在標準 CGI 腳本中,伺服器啟動腳本,向其發送單個請求,然後期望腳本終止。

在 FCGI 腳本中,伺服器啟動一次,然後發送多個請求,一次一個。這意味著您的腳本不應在單個請求後退出,而應僅在無法有效回答的錯誤條件下退出(即使它要使用 500 程式碼回答。)

所以,我相信你完全退出會讓 Apache 感到困惑。

引用自:https://serverfault.com/questions/84962