Comments, Tags ... not working [Solved]

This was causing all the problems:

FastCGI sent in stderr: "PHP message: PHP Deprecated:  Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid this warning set 'always_populate_raw_post_data' to '-1' in php.ini and use the php://input stream instead. in Unknown on line 0" while reading response header from upstream, client: 192.168.1.1, server: [MyServer URL], request: "POST /remote.php/dav/comments/files/4919171/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "[MyServer URL]"

Setting always_populate_raw_post_data = -1 in php.ini fixed issue. I assume this changed with newer versions of PHP (I am now using 5.6.30) and it is why I started having these issues.

; Always populate the $HTTP_RAW_POST_DATA variable. PHP's default behavior is
; to disable this feature and it will be removed in a future version.
; If post reading is disabled through enable_post_data_reading,
; $HTTP_RAW_POST_DATA is *NOT* populated.
; http://php.net/always-populate-raw-post-data
always_populate_raw_post_data = -1

Nextcloud version (eg, 10.0.2):
Operating system and version (eg, Ubuntu 16.04): Linux / Nextcloud 11.0.2
Apache or nginx version (eg, Apache 2.4.25): Nginx
PHP version (eg, 5.6): 5.6.30
Is this the first time you’ve seen this error?: No
Can you reliably replicate it? (If so, please outline steps): Attempt to create tag or comment

The issue you are facing: When I try and create a tag or a comment on a folder (probably in other areas) the tag is not created and comment is not saved. The following error is common for both issues:

{“reqId”:“XOrWUJsjrA4hMGW9m4ab”,“remoteAddr”:"{removed url}",“app”:“base”,“message”:“Exception: {“Exception”:“ErrorException”,“Message”:“Cannot modify header information - headers already sent”,“Code”:0,“Trace”:”#0 [internal function]: OC\\Session\\Internal->trapError(2, ‘Cannot modify h…’, ‘\/var\/www\/nextcl…’, 51, Array)\n#1 \/var\/www\/nextcloud\/lib\/private\/Session\/Internal.php(51): setcookie(‘occxgflk4o8b’, ‘’, -1, ‘\/’)\n#2 \/var\/www\/nextcloud\/lib\/base.php(428): OC\\Session\\Internal->__construct(‘occxgflk4o8b’)\n#3 \/var\/www\/nextcloud\/lib\/base.php(678): OC::initSession()\n#4 \/var\/www\/nextcloud\/lib\/base.php(1092): OC::init()\n#5 \/var\/www\/nextcloud\/remote.php(110): require_once(’\/var\/www\/nextcl…’)\n#6 {main}",“File”:"\/var\/www\/nextcloud\/lib\/private\/Session\/Internal.php",“Line”:146}",“level”:3,“time”:“2017-03-09T15:53:55+00:00”,“method”:“POST”,“url”:"/remote.php/dav/systemtags/",“user”:"–",“version”:“11.0.2.7”}

{“reqId”:“XOrWUJsjrA4hMGW9m4ab”,“remoteAddr”:"{removed url}",“app”:“remote”,“message”:“Exception: {“Exception”:“ErrorException”,“Message”:“Cannot modify header information - headers already sent”,“Code”:0,“Trace”:”#0 [internal function]: OC\\Session\\Internal->trapError(2, ‘Cannot modify h…’, ‘\/var\/www\/nextcl…’, 106, Array)\n#1 \/var\/www\/nextcloud\/lib\/private\/legacy\/response.php(106): header(‘HTTP\/1.1 500 In…’)\n#2 \/var\/www\/nextcloud\/lib\/base.php(439): OC_Response::setStatus(500)\n#3 \/var\/www\/nextcloud\/lib\/base.php(678): OC::initSession()\n#4 \/var\/www\/nextcloud\/lib\/base.php(1092): OC::init()\n#5 \/var\/www\/nextcloud\/remote.php(110): require_once(’\/var\/www\/nextcl…’)\n#6 {main}",“File”:"\/var\/www\/nextcloud\/lib\/private\/Session\/Internal.php",“Line”:146}",“level”:3,“time”:“2017-03-09T15:53:55+00:00”,“method”:“POST”,“url”:"/remote.php/dav/systemtags/",“user”:"–",“version”:“11.0.2.7”}

{“reqId”:“XOrWUJsjrA4hMGW9m4ab”,“remoteAddr”:"{removed url}",“app”:“PHP”,“message”:“ErrorException: Cannot modify header information - headers already sent at /var/www/nextcloud/lib/private/Session/Internal.php#146”,“level”:3,“time”:“2017-03-09T15:53:55+00:00”,“method”:“POST”,“url”:"/remote.php/dav/systemtags/",“user”:"–",“version”:“11.0.2.7”}
{“reqId”:“XOrWUJsjrA4hMGW9m4ab”,“remoteAddr”:"{removed url}",“app”:“PHP”,“message”:“Cannot modify header information - headers already sent at Unknown#0”,“level”:3,“time”:“2017-03-09T15:53:55+00:00”,“method”:“POST”,“url”:"/remote.php/dav/systemtags/",“user”:"–",“version”:“11.0.2.7”}

A little easier to read:

Error PHP Cannot modify header information - headers already sent at Unknown#0

Error PHP ErrorException: Cannot modify header information - headers already sent at /var/www/nextcloud/lib/private/Session/Internal.php#146

Error remote ErrorException: Cannot modify header information - headers already sent0.[internal function] OC\Session\Internal->trapError(2, ‘Cannot modify h…’, ‘/var/www/nextcl…’, 106, Array)
1./var/www/nextcloud/lib/private/legacy/response.php - line 106: header(‘HTTP/1.1 500 In…’)
2./var/www/nextcloud/lib/base.php - line 439: OC_Response setStatus(500)
3./var/www/nextcloud/lib/base.php - line 678: OC initSession()
4./var/www/nextcloud/lib/base.php - line 1092: OC init()
5./var/www/nextcloud/remote.php - line 110: require_once(’/var/www/nextcl…’)
6.{main}

Error base ErrorException: Cannot modify header information - headers already sent0.[internal function] OC\Session\Internal->trapError(2, ‘Cannot modify h…’, ‘/var/www/nextcl…’, 51, Array)
1./var/www/nextcloud/lib/private/Session/Internal.php - line 51: setcookie(‘occxgflk4o8b’, ‘’, -1, ‘/’)
2./var/www/nextcloud/lib/base.php - line 428: OC\Session\Internal->__construct(‘occxgflk4o8b’)
3./var/www/nextcloud/lib/base.php - line 678: OC initSession()
4./var/www/nextcloud/lib/base.php - line 1092: OC init()
5./var/www/nextcloud/remote.php - line 110: require_once(’/var/www/nextcl…’)
6.{main}

The error is difficult to link to a precise issue (there have been reports before). Do you use the nginx configuration from the documentation? Did it work in previous versions?

I did not use it in previous versions, but I did try it and it worked. I will verify my config against the documentation.

Double checking the latest nginx config for Nextcloud … still no working tags, folder comments, or file comments.