LoginSignup
2
0

More than 5 years have passed since last update.

ApacheでのFastCGIによるInternal Server Error

Posted at

突然のInternal Server Error

Webシステムで長時間処理を行っていた際、なぜか唐突にリクエストが中断され、Internal Server Errorとなった。
サーバー環境としては、以下の通り。

  • Windows Server
  • Apache2.4
  • PHP7
  • FastCGI

メモリ上限

タイムアウトにしては設定時間前にエラーが返ってきている。かなり重めの処理を行っているので、メモリの使用上限をphp.ini上で解除して再度実行してみたけれど、状況変わらず。

ログ

何かそれらしい情報がないかと思って探ってみるも、全くエラーの情報が出力されておらず。

mpm_winnt

設定ファイルを読み込むようにしてみたのだけれど、結果変わらず。

httpd.conf

設定ファイルの見直し。タイムアウトの設定は十分だし、リクエストの問題でもない。

<IfModule fcgid_module>
   FcgidInitialEnv PHPRC "c:/php"
   FcgidInitialEnv PHP_FCGI_MAX_REQUESTS 0
   FcgidMaxRequestLen 30000000
   FcgidIOTimeout 1800
   FcgidConnectTimeout 1800
</IfModule>

公式のドキュメントを見てみると、それらしき設定を発見。
https://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html#fcgidbusytimeout
確かに時間的にもデフォルトの時間でエラーとなっているっぽいし、重めの処理だから中断されてしまったのかもしれない。そもそもの作りがよくないのだとも言えるけれど。

早速追加して再度実行してみるとエラーは回避された。
最終的に以下のように。

<IfModule fcgid_module>
   FcgidInitialEnv PHPRC "c:/php"
   FcgidInitialEnv PHP_FCGI_MAX_REQUESTS 0
   FcgidMaxRequestLen 30000000
   FcgidIOTimeout 1800
   FcgidConnectTimeout 1800
   FcgidBusyTimeout 1800
</IfModule>
2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0