3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

PowerCMSXとnginx環境でflushエラーに対応

Last updated at Posted at 2020-10-13

はじめに

対象読者

  • PowerCMS X ユーザー
  • 以下のエラーに困っている人

対応したいエラー

  • pt-check.php 実行時に以下のエラーが発生する

システム出力バッファをフラッシュ(flush())することができませんでした。

image.png

  • このエラーが起きていると、フロントに対していつまでも結果が返ってこないままで固まってしまうということが起きうる

動作確認環境

  • Ubuntu 20.04
  • PHP 7.4 + PHP-FPM 7.4
  • nginx
  • PowerCMS X 2.20

やること

nginx の設定書き換え

編集内容

  • location ~ \.php$ ディレクティブの中に fastcgi_buffering off; を追記
    • fastcgi_buffers 8 128k; fastcgi_buffer_size 256k; 等の記述があれば削除

記述サンプル

# 前略

  location ~ \.php$ {
    fastcgi_buffering off;
    fastcgi_read_timeout 300;
    fastcgi_intercept_errors on;
    fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
  }

# 後略

参考

結果

  • エラー文が表示されなくなればよし

image.png

apache の場合……

<Proxy unix:/run/php-fpm/www.sock|fcgi://localhost>
    ProxySet flushpackets=on flushwait=20
</Proxy>

おわりに

感想

  • PowerCMS X 2.16 までは発生していなかったので 2.20 へ ver.up するにあたっての現象ですかね。ひとまずフロントに対しては処理した旨を返し、あとはバックエンド側で処理を続けておくというかたちになっているようです
  • この場合、バックエンド側でエラーが発生したらログが出力されるはずですが、そのエラーログを検知するしくみを別途用意しておかないとならない……?🤔
3
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
3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?