I've set up a new server on Debian Stretch.
The web server user is nginx:
ps aux | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\ -f1
nginx
I have already set the web server path to 775 and nginx recursively.
chown -R nginx:nginx /var/www/html/
chmod -R 775 /var/www/html
When I create a file, the user is root with the following permissions:
<?php file_put_contents ('/var/www/html/settings/test.json', 'Test file'); ?>
php test.php
-rw-r--r-- 1 root root 9 Apr 29 09:19 /var/www/html/settings/test.json
What else can I try?