I'm using Alpine / nginx / php 7.1.2.
I can't get php error's to display or output to the error.log in my nginx server block.
Access.log seems to work just fine.
I've got this at the bottom of www.conf in /usr/local/etc/php-fpm.d/
php_flag[display_errors] = on
php_admin_value[error_log] = /var/log/fpm-php.www.log
php_admin_flag[log_errors] = on
There is nothing in Docker logs and there are no errors in /var/log/fpm-php.www.log either...
What do I need to do display and log errors?
Edit: Also tried the error log as: /proc/self/fd/2
Looks like you use php-fpm? You have to configure your pool config and catch worker output.
Got it working :)
I had to set the error reporting level.
@asacarter do you remember what you set your reporting to? I have the same problem. I get the access_log but not the error_log.
php.ini:
error_reporting = E_ALL
log_errors = On
error_log = /proc/self/fd/2
php-fpm config:
access.log = /proc/self/fd/2
catch_workers_output = yes
@jaschaio It was a long time ago now, but this is what I have in www.conf
catch_workers_output = yes
php_flag[display_errors] = on
php_admin_value[error_log] = /var/www/log/php-error.log
php_admin_flag[log_errors] = on
php_admin_value[error_reporting] = E_ALL & ~E_NOTICE & ~E_WARNING & ~E_STRICT & ~E_DEPRECATED
php_admin_value[display_startup_errors] = on
Thanks for taking the time to reply @asacarter, I didn't incporated your changes as I already had those in my php.ini
What was missing was this at the top of my www.conf:
[global]
error_log = /proc/self/fd/2
Letting this here in case anybody else got the same problem. Thanks anyway!
can someone explain why the entry in php-fpm.d/docker.conf isn't enough?
In my case I still can't get the errors to be displayed correctly. Even though /usr/local/etc/php-fpm.d/docker.conf contains all the suggested above it just doesn't work at lease not for all errors.
This is the error received 172.20.0.7 - 30/Mar/2020:17:59:00 +0000 "GET /index.php" 500 go figure what causing it.
In my case I still can't get the errors to be displayed correctly. Even though
/usr/local/etc/php-fpm.d/docker.confcontains all the suggested above it just doesn't work at lease not for all errors.
This is the error received172.20.0.7 - 30/Mar/2020:17:59:00 +0000 "GET /index.php" 500go figure what causing it.
Im also having the same issue . even docker.conf already added the following above. .
The only thing I had to do was uncomment php_admin_flag[log_errors] = on in /usr/local/etc/php-fpm.d/www.conf.
Most helpful comment
@jaschaio It was a long time ago now, but this is what I have in
www.confcatch_workers_output = yes
php_flag[display_errors] = on
php_admin_value[error_log] = /var/www/log/php-error.log
php_admin_flag[log_errors] = on
php_admin_value[error_reporting] = E_ALL & ~E_NOTICE & ~E_WARNING & ~E_STRICT & ~E_DEPRECATED
php_admin_value[display_startup_errors] = on