Enable error logging on PHP-FPM 7 with Nginx?

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/

outputted

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

run

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