2

Note: I am NOT talking about nginx' own access log. That one works fine. This questions is about enabling the php-fpm access.log.


Currently, I am trying to debug the FastCGI sent in stderr: “Primary script unknown” while reading response header from upstream error

One proposed option is to set the access.log entry in the php-fpm.d/www.conf.

access.log = /var/log/$pool.access.log

Now, I have a docker stack and my php-fpm container is build from the php:7.3-fpm-alpine image.

While I have figured out that it stores its php config files at:

/usr/local/etc/php

and I also found the www.conf at:

/usr/local/etc/php-fpm.d/www.conf

So in a local file I add the default content as provided by the image and add at the end:

php_flag[display_errors] = on
php_admin_value[error_log] = /var/log/fpm-php.www.log
php_admin_flag[log_errors] = on
access.log = /var/log/$pool.access.log

and I copy that file during build into the docker container.

COPY ./.docker/php/www.conf /usr/local/etc/php-fpm.d/www.conf

Yet when I try to access my server, I don't see any log file being created on incoming requests.

What am I missing to activate the php-fpm access log? How can I figure out why I don't see any log?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
k0pernikus
  • 60,309
  • 67
  • 216
  • 347
  • Have you checked file permissions for the log path? Have you tried naming the file explicitly, create it through dockerfile with touch and modify the permissions? – CasualBen Jul 15 '20 at 14:27

1 Answers1

3

The way to do this is to send the error and the access logs to the following address:

/proc/self/fd/2

So replace the "file" locations like so:

access.log = /proc/self/fd/2
error_log = /proc/self/fd/2

Then you should be able to inspect the fpm-logs with docker logs [container-id]