LoginSignup
16
11

More than 3 years have passed since last update.

PHP-FPM がエラーログに余計な接頭辞をつけないようにする設定

Last updated at Posted at 2019-10-06

これまでは PHP-FPM で catch_workers_output = yes に設定のうえで、PHPコードから標準出力や標準エラー出力に出力を出すと、

WARNING: [pool www] child 101 said into stderr: "標準エラー出力に出した内容"

と、余計な接頭辞がつけられていました。

余計な接頭辞はDockerコンテナでログを標準出力/標準エラー出力で管理したいときに邪魔なものでした。
以前調べたときは解決策がなく同じような理由の Issue もあがっていたのですが、PHP 7.3 で追加された PHP-FPM の設定で解決できるようになっていました。

PHP-FPM の設定で decorate_workers_output を設定します。

php-fpm.conf
catch_workers_output = yes
decorate_workers_output = no

decorate_workers_output boolean
Enable the output decoration for workers output when catch_workers_output is enabled. Default value: yes. Available as of PHP 7.3.0.

参照: PHP: Configuration - Manual

16
11
1

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
16
11