/settings/ajax/setlanguage.php returns 500 with sample Nginx config

User can't change their language, debugging in Chrome says /settings/ajax/setlanguage.php returns a 500 error.

Freshly installed OwnCloud 9.1.3 on a Debain Wheezy server with Nginx 1.10.2, PHP 5.6.29 and MariaDB 10.0.28 with instructions on https://doc.owncloud.org/server/latest/admin_manual/installation/index.html and nginx example configuration on https://doc.owncloud.org/server/latest/admin_manual/installation/nginx_examples.html.

And here is the error log from Nginx server

2017/01/09 05:18:21 [error] 4672#4672: *1243 FastCGI sent in stderr: "PHP message: PHP Fatal error: Class 'OC' not found in /***/settings/ajax/setlanguage.php on line 27" while reading response header from upstream, client: , server: ***, request: "POST /settings/ajax/setlanguage.php HTTP/1.1", upstream: "fastcgi://unix:/:", host: "***"

most likely a 3rdparty app not compatible with oC 9.1+ is causing this issue.