Still error in the log

Maybe someone can advise how to deal with errors in the journal:
Cannot modify header information - headers already sent by (output started at /var/www/nextcloud/lib/private/Template/Base.php:136) at /var/www/nextcloud/lib/base.php#1111
I will oblige

Hello there ,

welcome to the community of Nextcloud.

You started a topic in support category.
Unfortunately you ignored the template and a lot of information to help you is missing.

Please add all necessary information like Nextcloud version, webserver type and version, os version, related log file content.

Without additional information the community members cannot help you.

Regards,
rakekniven

|Nextcloud version
[Nextcloud Hub 7 28.0.2)
|Operating system and version
Distributor ID: Ubuntu
Description: Ubuntu 23.10
Release: 23.10
Codename: mantic
|Apache or nginx version
Server version: Apache/2.4.57 (Ubuntu)
Server built: 2023-10-26T13:28:30
|PHP version (eg, 8.1):
PHP 8.2.10-2ubuntu1 (cli) (built: Sep 5 2023 14:37:47) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.10, Copyright (c) Zend Technologies
** with Zend OPcache v8.2.10-2ubuntu1, Copyright (c), by Zend Technologies**
** with Xdebug v3.2.0, Copyright (c) 2002-2022, by Derick Rethans**
|Database (sqlite or MariaDB or Postgres)
MariaDB
Type: mysql
Version: 10.11.6
|Docker (compose)||
No
|Snap||
No
|Is this the first time you’ve seen this error?
No
11186 errors in the logs since 26 stycznia 2024
The output of Nextcloud log in Admin > Logging:
The latest (each of 11186 is the same)
[PHP] Error: Cannot modify header information - headers already sent by (output started at /var/www/nextcloud/lib/private/Template/Base.php:136) at /var/www/nextcloud/lib/base.php#1111
** GET /**
** from 146.19.24.23 by – at 2 lut 2024, 16:30:13**

The output of your config.php:

<?php
$CONFIG = array (
  'instanceid' => '###',
  'passwordsalt' => '###',
  'secret' => '###',
  'trusted_domains' =>
  array (
    0 => '192.168.0.#',
    1 => '###',
    2 => '###',
    3 => '###',
    4 => '###',
  ),
  'datadirectory' => '/data',
  'dbtype' => 'mysql',
  'version' => '28.0.2.5',
  'overwrite.cli.url' => 'https://###',
  'htaccess.RewriteBase' => '/',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextbase',
  'dbpassword' => '###',
  'installed' => true,
  'default_phone_region' => 'PL',
  'filelocking.enabled' => true,
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => 'localhost',
    'port' => 6379,
    'dbindex' => 0,
    'password' => '',
    'timeout' => 1.5,
  ),
  'allow_local_remote_servers' => true,
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_from_address' => 'next',
  'mail_domain' => '###',
  'mail_smtphost' => '###',
  'mail_smtpport' => '587',
  'mail_smtpauth' => 1,
  'mail_smtpname' => '###',
  'mail_smtppassword' => '###',
  'maintenance' => false,
  'maintenance_window_start' => 1,
  'theme' => '',
  'loglevel' => 2,
  'data-fingerprint' => '###',
  'preview_libreoffice_path' => '/usr/bin/libreoffice',
  'filesystem_check_changes' => 1,
  'twofactor_enforced' => 'false',
  'twofactor_enforced_groups' =>
  array (
  ),
  'twofactor_enforced_excluded_groups' =>
  array (
  ),
  'updater.secret' => '###',
);

/var/log/apache2/error.log:

[Fri Feb 02 00:00:01.737374 2024] [mpm_event:notice] [pid 101800:tid 140301467445120] AH00489: Apache/2.4.57 (Ubuntu) mod_fcgid/2.3.9 OpenSSL/3.0.10 mod_jk/1.2.48 configured -- resuming normal operations
[Fri Feb 02 00:00:01.737397 2024] [core:notice] [pid 101800:tid 140301467445120] AH00094: Command line: '/usr/sbin/apache2'
[Fri Feb 02 06:18:58.323273 2024] [mpm_event:notice] [pid 101800:tid 140301467445120] AH00492: caught SIGWINCH, shutting down gracefully
[Fri Feb 02 06:18:59.802141 2024] [ssl:warn] [pid 111141:tid 139900052498304] AH01909: localhost:443:0 server certificate does NOT include an ID which matches the server name
[Fri Feb 02 06:18:59.821165 2024] [ssl:warn] [pid 111143:tid 139900052498304] AH01909: localhost:443:0 server certificate does NOT include an ID which matches the server name
[Fri Feb 02 06:18:59.824833 2024] [mpm_event:notice] [pid 111143:tid 139900052498304] AH00489: Apache/2.4.57 (Ubuntu) mod_fcgid/2.3.9 OpenSSL/3.0.10 mod_jk/1.2.48 configured -- resuming normal operations
[Fri Feb 02 06:18:59.824861 2024] [core:notice] [pid 111143:tid 139900052498304] AH00094: Command line: '/usr/sbin/apache2'
[Fri Feb 02 06:19:03.665437 2024] [proxy_fcgi:error] [pid 111146:tid 139899835299520] [remote 192.168.0.141:55788] AH01071: Got error 'PHP message: PHP Fatal error:  Uncaught Error: Undefined constant "\xe2\x80\x98maintenance_window_start\xe2\x80\x99" in /var/www/nextcloud/config/config.php:51\nStack trace:\n#0 /va>
[Fri Feb 02 06:19:05.830132 2024] [proxy_fcgi:error] [pid 111146:tid 139900028430016] [remote 192.168.0.141:55788] AH01071: Got error 'PHP message: PHP Fatal error:  Uncaught Error: Undefined constant "\xe2\x80\x98maintenance_window_start\xe2\x80\x99" in /var/www/nextcloud/config/config.php:51\nStack trace:\n#0 /va>
[Fri Feb 02 06:19:07.306980 2024] [proxy_fcgi:error] [pid 111146:tid 139900020037312] [remote 192.168.0.141:55788] AH01071: Got error 'PHP message: PHP Fatal error:  Uncaught Error: Undefined constant "\xe2\x80\x98maintenance_window_start\xe2\x80\x99" in /var/www/nextcloud/config/config.php:51\nStack trace:\n#0 /va>
[Fri Feb 02 06:19:07.349109 2024] [proxy_fcgi:error] [pid 111146:tid 139900011644608] [remote 192.168.0.141:55788] AH01071: Got error 'PHP message: PHP Fatal error:  Uncaught Error: Undefined constant "\xe2\x80\x98maintenance_window_start\xe2\x80\x99" in /var/www/nextcloud/config/config.php:51\nStack trace:\n#0 /va>
[Fri Feb 02 06:19:11.534666 2024] [proxy_fcgi:error] [pid 111146:tid 139900003251904] [remote 192.168.0.141:55788] AH01071: Got error 'PHP message: PHP Fatal error:  Uncaught Error: Undefined constant "\xe2\x80\x98maintenance_window_start\xe2\x80\x99" in /var/www/nextcloud/config/config.php:51\nStack trace:\n#0 /va>
[Fri Feb 02 06:19:11.568791 2024] [proxy_fcgi:error] [pid 111146:tid 139899994859200] [remote 192.168.0.141:55788] AH01071: Got error 'PHP message: PHP Fatal error:  Uncaught Error: Undefined constant "\xe2\x80\x98maintenance_window_start\xe2\x80\x99" in /var/www/nextcloud/config/config.php:51\nStack trace:\n#0 /va>
[Fri Feb 02 06:19:43.850033 2024] [proxy_fcgi:error] [pid 111145:tid 139899835299520] [remote 192.168.0.141:55858] AH01071: Got error 'PHP message: PHP Fatal error:  Uncaught Error: Undefined constant "\xe2\x80\x98maintenance_window_start\xe2\x80\x99" in /var/www/nextcloud/config/config.php:51\nStack trace:\n#0 /va>
[Fri Feb 02 06:19:43.898840 2024] [proxy_fcgi:error] [pid 111145:tid 139900028430016] [remote 192.168.0.141:55858] AH01071: Got error 'PHP message: PHP Fatal error:  Uncaught Error: Undefined constant "\xe2\x80\x98maintenance_window_start\xe2\x80\x99" in /var/www/nextcloud/config/config.php:51\nStack trace:\n#0 /va>
[Fri Feb 02 06:20:17.802689 2024] [mpm_event:notice] [pid 111143:tid 139900052498304] AH00492: caught SIGWINCH, shutting down gracefully
[Fri Feb 02 06:20:19.274026 2024] [ssl:warn] [pid 111286:tid 139803962222464] AH01909: localhost:443:0 server certificate does NOT include an ID which matches the server name
[Fri Feb 02 06:20:19.292745 2024] [ssl:warn] [pid 111287:tid 139803962222464] AH01909: localhost:443:0 server certificate does NOT include an ID which matches the server name
[Fri Feb 02 06:20:19.296394 2024] [mpm_event:notice] [pid 111287:tid 139803962222464] AH00489: Apache/2.4.57 (Ubuntu) mod_fcgid/2.3.9 OpenSSL/3.0.10 mod_jk/1.2.48 configured -- resuming normal operations
[Fri Feb 02 06:20:19.296425 2024] [core:notice] [pid 111287:tid 139803962222464] AH00094: Command line: '/usr/sbin/apache2'
[Fri Feb 02 07:07:57.195549 2024] [proxy_fcgi:error] [pid 111289:tid 139803904583360] [remote 89.234.255.68:5800] AH01067: Failed to read FastCGI header
[Fri Feb 02 07:07:57.195569 2024] [proxy_fcgi:error] [pid 111289:tid 139803921368768] [remote 89.234.255.68:5800] AH01067: Failed to read FastCGI header
[Fri Feb 02 07:07:57.195591 2024] [proxy_fcgi:error] [pid 111289:tid 139803904583360] (104)Connection reset by peer: [remote 89.234.255.68:5800] AH01075: Error dispatching request to :
[Fri Feb 02 07:07:57.195600 2024] [proxy_fcgi:error] [pid 111289:tid 139803921368768] (104)Connection reset by peer: [remote 89.234.255.68:5800] AH01075: Error dispatching request to :
[Fri Feb 02 12:10:14.940230 2024] [proxy:error] [pid 111289:tid 139803845834432] (103)Software caused connection abort: [remote 188.147.13.39:35146] AH01095: prefetch request body failed to 0.0.0.0:0 (httpd-UDS) from 188.147.13.39 ()

/var/log/mysql/slow.log:

SELECT `fc`.`fileid` FROM `oc_filecache` `fc` LEFT JOIN `oc_files_antivirus` `fa` ON `fc`.`fileid` = `fa`.`fileid` WHERE (`fa`.`fileid` IS NULL) AND (`mimetype` <> '2') AND (`path` LIKE 'files/%') AND (`fc`.`size` <> '0') LIMIT 1000;
# Time: 240202 13:23:04
# User@Host: nextbase[nextbase] @ localhost []
# Thread_id: 23598  Schema: nextcloud  QC_hit: No
# Query_time: 182.370688  Lock_time: 0.000071  Rows_sent: 0  Rows_examined: 1995779
# Rows_affected: 0  Bytes_sent: 84
SET timestamp=1706880184;
SELECT `fc`.`fileid` FROM `oc_filecache` `fc` LEFT JOIN `oc_files_antivirus` `fa` ON `fc`.`fileid` = `fa`.`fileid` WHERE (`fa`.`fileid` IS NULL) AND (`mimetype` <> '2') AND (`path` LIKE 'files/%') AND (`fc`.`size` <> '0') LIMIT 1000;
# Time: 240202 14:23:00
# User@Host: nextbase[nextbase] @ localhost []
# Thread_id: 24547  Schema: nextcloud  QC_hit: No
# Query_time: 177.850078  Lock_time: 0.000079  Rows_sent: 0  Rows_examined: 1995779
# Rows_affected: 0  Bytes_sent: 84
SET timestamp=1706883780;
SELECT `fc`.`fileid` FROM `oc_filecache` `fc` LEFT JOIN `oc_files_antivirus` `fa` ON `fc`.`fileid` = `fa`.`fileid` WHERE (`fa`.`fileid` IS NULL) AND (`mimetype` <> '2') AND (`path` LIKE 'files/%') AND (`fc`.`size` <> '0') LIMIT 1000;
# Time: 240202 14:43:00
# User@Host: nextbase[nextbase] @ localhost []
# Thread_id: 24862  Schema: nextcloud  QC_hit: No
# Query_time: 177.904918  Lock_time: 0.000083  Rows_sent: 0  Rows_examined: 1995779
# Rows_affected: 0  Bytes_sent: 84
SET timestamp=1706884980;
SELECT `fc`.`fileid` FROM `oc_filecache` `fc` LEFT JOIN `oc_files_antivirus` `fa` ON `fc`.`fileid` = `fa`.`fileid` WHERE (`fa`.`fileid` IS NULL) AND (`mimetype` <> '2') AND (`path` LIKE 'files/%') AND (`fc`.`size` <> '0') LIMIT 1000;

/var/log/ php8.2-fpm.log:

[28-Jan-2024 00:00:01] NOTICE: error log file re-opened
[30-Jan-2024 15:23:49] NOTICE: Terminating ...
[30-Jan-2024 15:23:49] NOTICE: exiting, bye-bye!
[30-Jan-2024 15:23:49] NOTICE: fpm is running, pid 61320
[30-Jan-2024 15:23:49] NOTICE: ready to handle connections
[30-Jan-2024 15:23:49] NOTICE: systemd monitor interval set to 10000ms
[30-Jan-2024 17:16:52] NOTICE: Terminating ...
[30-Jan-2024 17:16:52] NOTICE: exiting, bye-bye!
[30-Jan-2024 17:16:52] NOTICE: fpm is running, pid 63253
[30-Jan-2024 17:16:52] NOTICE: ready to handle connections
[30-Jan-2024 17:16:52] NOTICE: systemd monitor interval set to 10000ms
[01-Feb-2024 12:19:31] NOTICE: Terminating ...
[01-Feb-2024 12:19:31] NOTICE: exiting, bye-bye!
[01-Feb-2024 12:19:31] NOTICE: fpm is running, pid 93141
[01-Feb-2024 12:19:31] NOTICE: ready to handle connections
[01-Feb-2024 12:19:31] NOTICE: systemd monitor interval set to 10000ms
[01-Feb-2024 18:12:44] NOTICE: Terminating ...
[01-Feb-2024 18:12:44] NOTICE: exiting, bye-bye!
[01-Feb-2024 18:12:45] NOTICE: fpm is running, pid 101419
[01-Feb-2024 18:12:45] NOTICE: ready to handle connections
[01-Feb-2024 18:12:45] NOTICE: systemd monitor interval set to 10000ms
[02-Feb-2024 06:18:49] NOTICE: Terminating ...
[02-Feb-2024 06:18:49] NOTICE: exiting, bye-bye!
[02-Feb-2024 06:18:50] NOTICE: fpm is running, pid 111121
[02-Feb-2024 06:18:50] NOTICE: ready to handle connections
[02-Feb-2024 06:18:50] NOTICE: systemd monitor interval set to 10000ms
[02-Feb-2024 06:20:22] NOTICE: Terminating ...
[02-Feb-2024 06:20:22] NOTICE: exiting, bye-bye!
[02-Feb-2024 06:20:22] NOTICE: fpm is running, pid 111405
[02-Feb-2024 06:20:22] NOTICE: ready to handle connections
[02-Feb-2024 06:20:22] NOTICE: systemd monitor interval set to 10000ms
[02-Feb-2024 07:07:57] NOTICE: Terminating ...
[02-Feb-2024 07:07:57] NOTICE: exiting, bye-bye!
[02-Feb-2024 07:07:57] NOTICE: fpm is running, pid 112125
[02-Feb-2024 07:07:57] NOTICE: ready to handle connections
[02-Feb-2024 07:07:57] NOTICE: systemd monitor interval set to 10000ms
[02-Feb-2024 07:09:26] NOTICE: Terminating ...
[02-Feb-2024 07:09:26] NOTICE: exiting, bye-bye!
[02-Feb-2024 07:09:26] NOTICE: fpm is running, pid 112212
[02-Feb-2024 07:09:26] NOTICE: ready to handle connections
[02-Feb-2024 07:09:26] NOTICE: systemd monitor interval set to 10000ms

/var/log/syslog:

2024-02-02T15:39:01.010549+00:00 next systemd[1]: phpsessionclean.service: Deactivated successfully.
2024-02-02T15:39:01.010807+00:00 next systemd[1]: Finished phpsessionclean.service - Clean php session files.
2024-02-02T15:39:01.321847+00:00 next CRON[118423]: (root) CMD (  [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi)
2024-02-02T15:40:01.329009+00:00 next CRON[118432]: (root) CMD (php -f /var/www/nextcloud/cron.php)
2024-02-02T15:40:01.330856+00:00 next CRON[118434]: (www-data) CMD (php -f /var/www/nextcloud/cron.php --define apc.enable_cli=1)
2024-02-02T15:45:01.498524+00:00 next CRON[118471]: (root) CMD (php -f /var/www/nextcloud/cron.php)
2024-02-02T15:45:01.500329+00:00 next CRON[118473]: (www-data) CMD (php -f /var/www/nextcloud/cron.php --define apc.enable_cli=1)

That’s all folks :slight_smile:

I will be eternally grateful for your help

Kind of hard to read since none of them was included in a preformatted text block. :slight_smile: But this stood out:

Uncaught Error: Undefined constant "\xe2\x80\x98maintenance_window_start\xe2\x80\x99" in /var/www/nextcloud/config/config.php:51

When you run occ config:list system (or equivalent adapted to your environment), does the config look complete?

Somewhere you have a weird character in there. It may be a weird character from cutting and parting.

{
“system”: {
“instanceid”: “REMOVED SENSITIVE VALUE”,
“passwordsalt”: “REMOVED SENSITIVE VALUE”,
“secret”: “REMOVED SENSITIVE VALUE”,
“trusted_domains”: [
“192.168.0.6”,
nextres.ddns.net”,
“next.local”,
“next.reok.pl”,
“nas.reok.pl”
],
“datadirectory”: “REMOVED SENSITIVE VALUE”,
“dbtype”: “mysql”,
“version”: “28.0.2.5”,
“overwrite.cli.url”: “https://next.reok.pl”,
“htaccess.RewriteBase”: “/”,
“dbname”: “REMOVED SENSITIVE VALUE”,
“dbhost”: “REMOVED SENSITIVE VALUE”,
“dbport”: “”,
“dbtableprefix”: “oc_”,
“mysql.utf8mb4”: true,
“dbuser”: “REMOVED SENSITIVE VALUE”,
“dbpassword”: “REMOVED SENSITIVE VALUE”,
“installed”: true,
“default_phone_region”: “PL”,
“filelocking.enabled”: true,
“memcache.local”: “\OC\Memcache\Redis”,
“memcache.distributed”: “\OC\Memcache\Redis”,
“memcache.locking”: “\OC\Memcache\Redis”,
“redis”: {
“host”: “REMOVED SENSITIVE VALUE”,
“port”: 6379,
“dbindex”: 0,
“password”: “REMOVED SENSITIVE VALUE”,
“timeout”: 1.5
},
“allow_local_remote_servers”: true,
“mail_smtpmode”: “smtp”,
“mail_sendmailmode”: “smtp”,
“mail_from_address”: “REMOVED SENSITIVE VALUE”,
“mail_domain”: “REMOVED SENSITIVE VALUE”,
“mail_smtphost”: “REMOVED SENSITIVE VALUE”,
“mail_smtpport”: “587”,
“mail_smtpauth”: 1,
“mail_smtpname”: “REMOVED SENSITIVE VALUE”,
“mail_smtppassword”: “REMOVED SENSITIVE VALUE”,
“maintenance”: false,
“maintenance_window_start”: 1,
“theme”: “”,
“loglevel”: 2,
“data-fingerprint”: “fbc231548743366334fbc99d8098a1f2”,
“preview_libreoffice_path”: “/usr/bin/libreoffice”,
“filesystem_check_changes”: 1,
“twofactor_enforced”: “false”,
“twofactor_enforced_groups”: ,
“twofactor_enforced_excluded_groups”: ,
“updater.secret”: “REMOVED SENSITIVE VALUE
}
}

Possible error
Uncaught Error: Undefined constant “\xe2\x80\x98maintenance_window_start\xe2\x80\x99” in /var/www/nextcloud/config/config.php:51
is irrelevant to the information that is repeated over and over again:
{“reqId”:“mp2HoTuJ5h5pbPnX3Ut0”,“level”:3,“time”:“2024-02-03T04:51:28+00:00”,“remoteAddr”:“45.157.11.10”,“user”:" --“,“app”:“PHP”,“method”:“GET”,“url”:”/“,“message”:“Cannot modify header information - headers already sent by (output started at /var/www /nextcloud/lib/private/Template/Base.php:136) at /var/www/nextcloud/lib/base.php#1111”,“userAgent”:”–",“version”:“28.0.2.5” ,“data”:{“app”:“PHP”},“id”:“65bdd3ca9272b”}
I have been struggling with this problem since updating nextcloud to v28.
“maintenance_window_start” entry: 1, I entered it a few days ago after updating to v28.0.2

If you remove this line, everything is working?

Could be that your quote sign in that line is different from the others?

Yes. I removed this line but the error still persists.
Currently, I have 29166 errors in the logs since January 30, 2024. All the same: Cannot modify header information - headers already sent by (output started at /var/www/nextcloud/lib/private/Template/Base.php:136 ) at /var/www/nextcloud/lib/base.php#1111

Again, can you please post your config in a preformatted text block? There is an icon for it </>.

In addition, can you confirm that output is the unedited output of occ config:list system? (I ask because I’d expect three asterisks to appear surrounding the REMOVED SENSITIVE VALUE entries; also because I’d expect it to generate a similar error message as the one you’re seeing in your Apache log).

Also, after you made the config change did you restart Apache?

The error is very specific:

/var/www/nextcloud/config/config.php:51

Line 51 in your config file.

This is not the cause. The error still occurs in large numbers.
Interestingly, the error appeared after upgrading to version 28.
I can’t deal with it.