Cannot modify header information (Sapi.php:132) NC 19.0.2
How to use GitHub
- Please use the 👍 reaction to show that you are affected by the same issue.
- Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
- Subscribe to receive notifications on status change and new comments.
Steps to reproduce
Upgrade to NC 19.0.2.
Expected behaviour
No PHP errors in the log.
Actual behaviour
Since upgrade to 19.0.2 many error messages like this in the log:
[PHP] Error: Cannot modify header information - headers already sent by
(output started at /var/www/nextcloud/3rdparty/sabre/http/lib/Sapi.php:132)
at /var/www/nextcloud/apps/dav/lib/Connector/Sabre/File.php#680
PUT /remote.php/dav/uploads/john/4291849725/00000002
from 111.222.333.444 by john at 2020-08-29T19:34:41+02:00
{"reqId":"Or0R2pucFGt5YGzIyZcI","level":3,"time":"2020-08-29T19:34:41+02:00","remoteAddr":"111.222.333.444",
"user":"john","app":"PHP","method":"PUT","url":"/remote.php/dav/uploads/john/4291849725/00000002",
"message":"Cannot modify header information - headers already sent by
(output started at /var/www/nextcloud/3rdparty/sabre/http/lib/Sapi.php:132)
at /var/www/nextcloud/apps/dav/lib/Connector/Sabre/File.php#680",
"userAgent":"Mozilla/5.0 (Windows) mirall/2.6.5stable-Win64 (build 20200710) (Nextcloud)","version":"19.0.2.2","id":"5f4c9578c0b93"}
Server configuration
Operating system: Ubuntu 18.04.5 LTS Web server: nginx version: nginx/1.19.2 Database: MariaDB 10.1.44 PHP version: 7.2.33 (PHP 7.2.33-1+ubuntu18.04.1+deb.sury.org+1) Nextcloud version: 19.0.2 Updated from an older Nextcloud/ownCloud or fresh install: Updated from 18.0.8 Where did you install Nextcloud from: Web admin update Signing status:
Signing status
No errors have been found.
List of activated apps:
App list
Enabled:
- accessibility: 1.5.0
- activity: 2.12.0
- admin_audit: 1.9.0
- calendar: 2.0.4
- cloud_federation_api: 1.2.0
- comments: 1.9.0
- contacts: 3.3.0
- contactsinteraction: 1.0.0
- dav: 1.15.0
- federatedfilesharing: 1.9.0
- files: 1.14.0
- files_pdfviewer: 1.8.0
- files_rightclick: 0.16.0
- files_sharing: 1.11.0
- files_trashbin: 1.9.0
- files_versions: 1.12.0
- files_videoplayer: 1.8.0
- logreader: 2.4.0
- lookup_server_connector: 1.7.0
- nextcloud_announcements: 1.8.0
- notes: 3.6.4
- notifications: 2.7.0
- oauth2: 1.7.0
- password_policy: 1.9.1
- photos: 1.1.0
- privacy: 1.3.0
- provisioning_api: 1.9.0
- recommendations: 0.7.0
- richdocuments: 3.7.3
- serverinfo: 1.9.0
- settings: 1.1.0
- sharebymail: 1.9.0
- spreed: 9.0.3
- support: 1.2.1
- tasks: 0.13.3
- text: 3.0.1
- theming: 1.10.0
- twofactor_backupcodes: 1.8.0
- updatenotification: 1.9.0
- viewer: 1.3.0
- workflowengine: 2.1.0
Disabled:
- encryption
- federation
- files_external
- firstrunwizard
- survey_client
- systemtags
- user_ldap
Nextcloud configuration:
Config report
{
"system": {
"instanceid": "***REMOVED SENSITIVE VALUE***",
"passwordsalt": "***REMOVED SENSITIVE VALUE***",
"secret": "***REMOVED SENSITIVE VALUE***",
"trusted_domains": [
"localhost",
"cloud.mydomain.com"
],
"datadirectory": "***REMOVED SENSITIVE VALUE***",
"overwrite.cli.url": "https:\/\/cloud.mydomain.com",
"dbtype": "mysql",
"version": "19.0.2.2",
"dbname": "***REMOVED SENSITIVE VALUE***",
"dbhost": "***REMOVED SENSITIVE VALUE***",
"dbport": "",
"dbtableprefix": "oc_",
"mysql.utf8mb4": true,
"dbuser": "***REMOVED SENSITIVE VALUE***",
"dbpassword": "***REMOVED SENSITIVE VALUE***",
"installed": true,
"activity_expire_days": 14,
"auth.bruteforce.protection.enabled": true,
"blacklisted_files": [
".htaccess",
"Thumbs.db",
"thumbs.db"
],
"cron_log": true,
"enable_previews": true,
"enabledPreviewProviders": [
"OC\\Preview\\PNG",
"OC\\Preview\\JPEG",
"OC\\Preview\\GIF",
"OC\\Preview\\BMP",
"OC\\Preview\\XBitmap",
"OC\\Preview\\Movie",
"OC\\Preview\\PDF",
"OC\\Preview\\MP3",
"OC\\Preview\\TXT",
"OC\\Preview\\MarkDown"
],
"filesystem_check_changes": 0,
"filelocking.enabled": "true",
"htaccess.RewriteBase": "\/",
"integrity.check.disabled": false,
"knowledgebaseenabled": false,
"logfile": "\/var\/nc_data\/nextcloud.log",
"loglevel": 2,
"logtimezone": "Europe\/Prague",
"log_rotate_size": 104857600,
"maintenance": false,
"memcache.local": "\\OC\\Memcache\\APCu",
"memcache.locking": "\\OC\\Memcache\\Redis",
"overwriteprotocol": "https",
"preview_max_x": 1024,
"preview_max_y": 768,
"preview_max_scale_factor": 1,
"redis": {
"host": "***REMOVED SENSITIVE VALUE***",
"port": 0,
"timeout": 0
},
"quota_include_external_storage": false,
"share_folder": "\/Shares",
"skeletondirectory": "",
"theme": "",
"trashbin_retention_obligation": "auto, 7",
"updater.release.channel": "stable",
"mail_smtpmode": "smtp",
"mail_smtpauthtype": "LOGIN",
"mail_smtpsecure": "tls",
"mail_from_address": "***REMOVED SENSITIVE VALUE***",
"mail_domain": "***REMOVED SENSITIVE VALUE***",
"mail_smtpauth": 1,
"mail_smtphost": "***REMOVED SENSITIVE VALUE***",
"mail_smtpport": "587",
"mail_smtpname": "***REMOVED SENSITIVE VALUE***",
"mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
"mail_smtptimeout": 45,
"force_language": "cs",
"lost_password_link": "disabled",
"mail_sendmailmode": "smtp"
}
}
Are you using external storage, if yes which one: no
Are you using encryption: no
Are you using an external user-backend, if yes which one: no
Client configuration
Browser:
Operating system:
Logs
Web server error log
Web server error log
Insert your webserver log here
Nextcloud log (data/nextcloud.log)
Nextcloud log
Similar messages repeated many times:{"reqId":"xTDKPVJiXelxcS5xfQ2F","level":3,"time":"2020-08-28T16:03:27+02:00","remoteAddr":"555.666.777.888","user":"john","app":"no app in context","method":"PUT","url":"/remote.php/webdav/WORK/myfile.txt","message":{"Exception":"Sabre\\DAV\\Exception\\BadRequest","Message":"Expected filesize of 1303 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 0 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.","Code":0,"Trace":[{"file":"/var/www/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php","line":154,"function":"put","class":"OCA\\DAV\\Connector\\Sabre\\File","type":"->","args":[null]},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":1104,"function":"createFile","class":"OCA\\DAV\\Connector\\Sabre\\Directory","type":"->","args":["myfile.txt",null]},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php","line":527,"function":"createFile","class":"Sabre\\DAV\\Server","type":"->","args":["WORK/myfile.txt",null,null]},{"file":"/var/www/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php","line":89,"function":"httpPut","class":"Sabre\\DAV\\CorePlugin","type":"->","args":[{"__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":474,"function":"emit","class":"Sabre\\DAV\\Server","type":"->","args":["method:PUT",[{"__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]]},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":251,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->","args":[{"__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":319,"function":"start","class":"Sabre\\DAV\\Server","type":"->","args":[]},{"file":"/var/www/nextcloud/apps/dav/appinfo/v1/webdav.php","line":82,"function":"exec","class":"Sabre\\DAV\\Server","type":"->","args":[]},{"file":"/var/www/nextcloud/remote.php","line":167,"args":["/var/www/nextcloud/apps/dav/appinfo/v1/webdav.php"],"function":"require_once"}],"File":"/var/www/nextcloud/apps/dav/lib/Connector/Sabre/File.php","Line":238,"CustomMessage":"--"},"userAgent":"--","version":"19.0.2.2"}
{"reqId":"Or0R2pucFGt5YGzIyZcI","level":3,"time":"2020-08-29T19:34:41+02:00","remoteAddr":"111.222.333.444","user":"john","app":"PHP","method":"PUT","url":"/remote.php/dav/uploads/john/4291849725/00000002","message":"Cannot modify header information - headers already sent by (output started at /var/www/nextcloud/3rdparty/sabre/http/lib/Sapi.php:132) at /var/www/nextcloud/apps/dav/lib/Connector/Sabre/File.php#680","userAgent":"Mozilla/5.0 (Windows) mirall/2.6.5stable-Win64 (build 20200710) (Nextcloud)","version":"19.0.2.2"}
Browser log
Browser log
Insert your browser log here, this could for example include:
a) The javascript console log
b) The network log
c) ...
In my case it stopped in itself. The messages were appearing in 2 days after upgrade. Nothing since. Don't know why and it seems we didn't lose any files. But there has to be something wrong because it's a PHP error.
i have the same proplem and because of that I can't upload files properly :((
i have the same proplem and because of that I can't upload files properly :((
Yup me too
Ich habe das gleiche Problem und aus diesem Grund kann ich Dateien nicht richtig hochladen: ((
Yup ich auch
like 250 Kb/s and at the end an error/abort or freeze?
I am having this error as well, it's generating quite a huge log file and masking out the other potentially important errors. Any resolution to this? On NC v19.0.2
Edit: Updated to v19.0.3 still experiencing the same issue
It's back again after upgrade to 19.0.3. The number after hash in the log message has changed from 680 to 683.
Cannot modify header information - headers already sent by (output started at /var/www/nextcloud/3rdparty/sabre/http/lib/Sapi.php:132) at /var/www/nextcloud/apps/dav/lib/Connector/Sabre/File.php#683
I have the same Error on Linux, Mac and Android Clients. I can't upload any files.
Same here no sync possible on any platform.
The same thing happens here, regardless of the client operating system. However, using the oCluod client on Android, the Nexcluod server (19.0.3 on Debian 10) accepts the upload of those files that it refuses if uploaded from the Nextcloud client
By reverting client to 2.6.5 the sync works again. Avoid client 3.x for now.
Same error in 19.0.3, even uploading via browser is not working...
I did little research, i can upload really smal files some kb, but imgaes some mb are not possible....
Same error in Nextcloud 19.0.3. Uploading small text file in browser to WedDav external store is not working.
Frontend says: "Er trad een onbekende fout op." (dutch).
nextcloud.log says "Cannot modify header information - headers already sent by (output started at
I found workaround that worked for me for the webclient. I removed my DropboxV2 external storage and removed the external dir of the WebDav storage. Now it works (both in the ios app and in the webclient).
With Nextcloud 19.0.4 the situation does not change. Only one line number is different in the error message (#683 -> #690)
Error: Cannot modify header information - headers already sent by (output started at /var/www/html/nextcloud/3rdparty/sabre/http/lib/Sapi.php:132) at /var/www/html/nextcloud/apps/dav/lib/Connector/Sabre/File.php#690
Same error for me on Nextcloud 19.0.3. line number is #683 How fix it ??
Same here. I did a fresh Nextcloud 20.0.0 installation and I get the following, if I upload a file to a shared folder through a shared link:
`Error: Cannot modify header information - headers already sent by (output started at /config/www/nextcloud/3rdparty/sabre/http/lib/Sapi.php:132) at /config/www/nextcloud/apps/dav/lib/Connector/Sabre/File.php#691
<<closure>>
OC\Log\ErrorHandler::onError(2, "Cannot modi ... )", "/config/www ... p", 691, { string: "X ... "})
/config/www/nextcloud/apps/dav/lib/Connector/Sabre/File.php - line 691:
header("X-Hash-MD5: ... 9")
/config/www/nextcloud/apps/dav/lib/Connector/Sabre/File.php - line 189:
OCA\DAV\Connector\Sabre\File->header("X-Hash-MD5: ... 9")
<<closure>>
OCA\DAV\Connector\Sabre\File->OCA\DAV\Connector\Sabre\{closure}("*** sensiti ... *")
/config/www/nextcloud/lib/private/Files/Stream/HashWrapper.php - line 71:
call_user_func(Closure {}, "*** sensiti ... *")
<<closure>>
OC\Files\Stream\HashWrapper->stream_close()
/config/www/nextcloud/3rdparty/icewind/streams/src/Wrapper.php - line 132:
fclose(null)
/config/www/nextcloud/lib/private/Files/Stream/HashWrapper.php - line 75:
Icewind\Streams\Wrapper->stream_close()
<<closure>>
OC\Files\Stream\HashWrapper->stream_close()
/config/www/nextcloud/3rdparty/icewind/streams/src/Wrapper.php - line 132:
fclose(null)
/config/www/nextcloud/lib/private/Files/Stream/HashWrapper.php - line 75:
Icewind\Streams\Wrapper->stream_close()
/config/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 319:
OC\Files\Stream\HashWrapper->stream_close()
/config/www/nextcloud/apps/dav/appinfo/v1/publicwebdav.php - line 113:
Sabre\DAV\Server->exec()
/config/www/nextcloud/public.php - line 81:
require_once("/config/www ... p")`
But I can upload without issues, if I login with my user account.
It's not a solution, but it is something.. I had the same error since I made an update to 19.0.3. But now the error is gone, after I changed the local network. I don't know how this affects anything, all I know is, that the working network has a better upstream (downstream is equal). I couldn't check yet if it still fails with this error in the other network, but maybe I can test later and will report interesting results.
It's not a solution, but it is something.. I had the same error since I made an update to 19.0.3. But now the error is gone, after I changed the local network. I don't know how this affects anything, all I know is, that the working network has a better upstream (downstream is equal). I couldn't check yet if it still fails with this error in the other network, but maybe I can test later and will report interesting results.
I'm still trying to find solutions. Everything worked well with the 18.0.x then, from 19.0.3 onwards I can only upload files of less than 1.5 MB. This is as much with the Android/iOS client as it is with the browser. What puzzles me is that I can easily load 1 GB files if I use oClud.de
Same problem with 19.0.4 here, using client version 3.0.2 on Windows. No problems at all when uploading files through the web interface.
I had the same issue (NC 19.0.4) I had configure an external storage to a SMB share that was off-line. I remove the configuration and all works well
Here is a full stack trace, maybe that helps in understanding the underlying issue. In this case it was triggered by an upload from the Android app:
{
"reqId": "vMp9gJTkQ9DTydtEtHBm",
"level": 3,
"time": "2020-10-16T23:20:17+02:00",
"remoteAddr": "111.222.333.444",
"user": "theuser",
"app": "PHP",
"method": "PUT",
"url": "/remote.php/dav/uploads/theuser/35596bf55d30b13fda6d265b8f116e16/0000000000000000-0000000002351377",
"message": {
"Exception": "Error",
"Message": "Cannot modify header information - headers already sent by (output started at /var/www/nextcloud/3rdparty/sabre/http/lib/Sapi.php:132) at /var/www/nextcloud/apps/dav/lib/Connector/Sabre/File.php#690",
"Code": 0,
"Trace": [{
"function": "onError",
"class": "OC\\Log\\ErrorHandler",
"type": "::",
"args": [2, "Cannot modify header information - headers already sent by (output started at /var/www/nextcloud/3rdparty/sabre/http/lib/Sapi.php:132)", "/var/www/nextcloud/apps/dav/lib/Connector/Sabre/File.php", 690, {
"string": "X-Hash-MD5: 4cb41cb7e045d80a78da4789ee637ede"
}]
}, {
"file": "/var/www/nextcloud/apps/dav/lib/Connector/Sabre/File.php",
"line": 690,
"function": "header",
"args": ["X-Hash-MD5: 4cb41cb7e045d80a78da4789ee637ede"]
}, {
"file": "/var/www/nextcloud/apps/dav/lib/Connector/Sabre/File.php",
"line": 188,
"function": "header",
"class": "OCA\\DAV\\Connector\\Sabre\\File",
"type": "->",
"args": ["X-Hash-MD5: 4cb41cb7e045d80a78da4789ee637ede"]
}, {
"function": "OCA\\DAV\\Connector\\Sabre\\{closure}",
"class": "OCA\\DAV\\Connector\\Sabre\\File",
"type": "->",
"args": ["*** sensitive parameters replaced ***"]
}, {
"file": "/var/www/nextcloud/lib/private/Files/Stream/HashWrapper.php",
"line": 71,
"function": "call_user_func",
"args": [{
"__class__": "Closure"
}, "*** sensitive parameter replaced ***"]
}, {
"function": "stream_close",
"class": "OC\\Files\\Stream\\HashWrapper",
"type": "->",
"args": []
}, {
"file": "/var/www/nextcloud/3rdparty/icewind/streams/src/Wrapper.php",
"line": 132,
"function": "fclose",
"args": [null]
}, {
"file": "/var/www/nextcloud/lib/private/Files/Stream/HashWrapper.php",
"line": 75,
"function": "stream_close",
"class": "Icewind\\Streams\\Wrapper",
"type": "->",
"args": []
}, {
"function": "stream_close",
"class": "OC\\Files\\Stream\\HashWrapper",
"type": "->",
"args": []
}, {
"file": "/var/www/nextcloud/3rdparty/icewind/streams/src/Wrapper.php",
"line": 132,
"function": "fclose",
"args": [null]
}, {
"file": "/var/www/nextcloud/lib/private/Files/Stream/HashWrapper.php",
"line": 75,
"function": "stream_close",
"class": "Icewind\\Streams\\Wrapper",
"type": "->",
"args": []
}, {
"file": "/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php",
"line": 319,
"function": "stream_close",
"class": "OC\\Files\\Stream\\HashWrapper",
"type": "->",
"args": []
}, {
"file": "/var/www/nextcloud/apps/dav/lib/Server.php",
"line": 320,
"function": "exec",
"class": "Sabre\\DAV\\Server",
"type": "->",
"args": []
}, {
"file": "/var/www/nextcloud/apps/dav/appinfo/v2/remote.php",
"line": 35,
"function": "exec",
"class": "OCA\\DAV\\Server",
"type": "->",
"args": []
}, {
"file": "/var/www/nextcloud/remote.php",
"line": 167,
"args": ["/var/www/nextcloud/apps/dav/appinfo/v2/remote.php"],
"function": "require_once"
}],
"File": "/var/www/nextcloud/lib/private/Log/ErrorHandler.php",
"Line": 91,
"CustomMessage": "--"
},
"userAgent": "Mozilla/5.0 (Android) Nextcloud-android/3.13.1",
"version": "19.0.4.2",
"id": "5f8b113f613e3"