This is essentially the same as these questions:


Nginx not logging PHP errors

BUT the answers there don't seem to be working on Ubuntu 16.04 with PHP 7.


catch_workers_output = yes
php_flag[display_errors] = on
php_admin_value[error_log] = /var/log/fpm-php.www.log
php_admin_flag[log_errors] = on

/var/log/fpm-php.www.log exists and is owned by www-data.


log_errors = On

Nginx Virtual Host's Server block

access_log /var/log/myapp/access.log;
error_log /var/log/myapp/error.log error;

/var/log/myapp/access.log exists and is owned by www-data.

But when an error occurs, I don't get an error in any of the specified log files, and can't find it in any other place either.

I went through all of the suggestions on the other question but didn't find any answer that worked. I'm assuming something has changed since those answer were posted. Any suggestions?

  • Try to see ini_get('log_errors') and ini_get('error_log'), maybe your app logs them to a custom location
    – the_nuts
    Feb 8, 2017 at 6:55
  • Create a simple file to display the output of phpinfo(), browse this file via browser, check the paths are correct, then remove the semicolon at the end of phpinfo(); to trigger an error. Feb 8, 2017 at 7:57
  • For Nginx related errors, please check for errors in the default file location in Ubuntu 16.04 that is /var/log/nginx/error.log. Feb 8, 2017 at 7:58

1 Answer 1


The comment above by the_nuts helped solve it for me. The directory and file didn't exist.

To diagnose, I added:

print("\n\n<br><br>log_errors: ".ini_get('log_errors'));
print("\n\n<br><br>error_log: ".ini_get('error_log'));

to the top of my code (a WordPress plugin). This outputted:

log_errors: 1
error_log: /usr/local/etc/php-fpm.d/fpm.log 

In terminal I used ls to learn the file and directory were missing, i.e.

ls /usr/local/etc/php-fpm.d/fpm.log
ls /usr/local/etc/php-fpm.d/


ls: cannot access '/usr/local/etc/php-fpm.d/fpm.log': No such file or directory
ls: cannot access '/usr/local/etc/php-fpm.d': No such file or directory

To fix: I changed directory to /usr/local/etc, created the directory, the file and then set the owner to www-data:www-data

cd /usr/local/etc
sudo mkdir php-fpm.d
cd php-fpm.d
sudo touch fpm.log
sudo chown -R www-data:www-data fpm.log

If the file and directory do exist, run

ls fpm.log -l

and if owner is root:

-rw-r--r-- 1 root root 0 Jun 23 19:52 fpm.log


sudo chown -R www-data:www-data fpm.log

to give the web server ownership and write access

-rw-r--r-- 1 www-data www-data 12848 Jun 23 20:07 fpm.log

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .