Error","Message":"ini_set(): Headers already sent. You cannot change the session module's ini settings at this time at

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 20.0.5): 21.0.1
Operating system and version (eg, Ubuntu 20.04): Debian GNU/Linux 10 (buster) -> Rasberry pi 4 64bit
Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.38 (Debian)
PHP version (eg, 7.4): PHP/7.4.19

The issue you are facing:

When opening the home page I am getting a blue screen with this message.
Sorry it is in french :frowning:

Erreur interne du serveur

Le serveur est incapable d’exécuter votre requête.

Si cela se reproduit, veuillez envoyer les détails techniques ci-dessous à l’administrateur du serveur.

Le fichier journal du serveur peut fournir plus de renseignements.

Renseignements techniques

  • Adresse distante : 192.168.1.40
  • ID de la demande : sF8LLCYguyNdB7W9TrNM

Is this the first time you’ve seen this error? (Y/N): Yes

Steps to replicate it:

  1. Open brower
  2. go to HTTP://LocalIP:8080

The output of your Nextcloud log in Admin > Logging:

{"reqId":"iHHoqJNvzlKdtwFZfIw4","level":3,"time":"2021-05-18T15:41:24+00:00","remoteAddr":"192.168.1.40","user":"--","app":"PHP","method":"GET","url":"/","message":{"Exception":"Error","Message":"ini_set(): Headers already sent. You cannot change the session module's ini settings at this time at /var/www/html/lib/base.php#406","Code":0,"Trace":[{"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::","args":[2,"ini_set(): Headers already sent. You cannot change the session module's ini settings at this time","/var/www/html/lib/base.php",406,[]]},{"file":"/var/www/html/lib/base.php","line":406,"function":"ini_set","args":["session.cookie_httponly","true"]},{"file":"/var/www/html/lib/base.php","line":639,"function":"initSession","class":"OC","type":"::","args":[]},{"file":"/var/www/html/lib/base.php","line":1076,"function":"init","class":"OC","type":"::","args":[]},{"file":"/var/www/html/index.php","line":35,"args":["/var/www/html/lib/base.php"],"function":"require_once"}],"File":"/var/www/html/lib/private/Log/ErrorHandler.php","Line":92,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36","version":"21.0.1.1"}

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'htaccess.RewriteBase' => '/',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'apps_paths' => 
  array (
    0 => 
    array (
      'path' => '/var/www/html/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 => 
    array (
      'path' => '/var/www/html/custom_apps',
      'url' => '/custom_apps',
      'writable' => true,
    ),
  ),
  'instanceid' => 'oco2vz2ux5lz',
  'passwordsalt' => 'xxxxxx',
  'secret' => 'xxxxx',
  'trusted_domains' => 
  array (
    0 => '192.168.1.19:8080',
  ),
  'datadirectory' => '/var/www/html/data',
  'dbtype' => 'mysql',
  'version' => '21.0.1.1',
  'overwrite.cli.url' => 'http://192.168.1.19:8080',
  'dbname' => 'nextcloud',
  'dbhost' => 'db',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'xxxx',
  'dbpassword' => 'xxxx',
  'installed' => true,
);

The output of your Apache/nginx/system log in /var/log/____:

192.168.1.40 - - [18/May/2021:15:36:48 +0000] "GET /index.php/csrftoken HTTP/1.1" 200 1829 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36"


192.168.1.40 - - [18/May/2021:15:41:24 +0000] "GET / HTTP/1.1" 200 1827 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36"


192.168.1.40 - - [18/May/2021:15:41:24 +0000] "GET /core/img/background.png?v=2 HTTP/1.1" 304 181 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36"


192.168.1.40 - - [18/May/2021:15:45:11 +0000] "GET / HTTP/1.1" 200 1829 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Safari/605.1.15"


192.168.1.40 - - [18/May/2021:15:45:11 +0000] "GET /core/css/guest.css?v=fd2e34f8-0 HTTP/1.1" 200 6111 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Safari/605.1.15"


192.168.1.40 - - [18/May/2021:15:45:11 +0000] "GET /core/js/dist/files_fileinfo.js?v=fd2e34f8-0 HTTP/1.1" 200 9497 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Safari/605.1.15"


192.168.1.40 - - [18/May/2021:15:45:11 +0000] "GET /core/img/background.png?v=2 HTTP/1.1" 200 10121 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Safari/605.1.15"


192.168.1.40 - - [18/May/2021:15:45:11 +0000] "GET /core/js/dist/files_client.js?v=fd2e34f8-0 HTTP/1.1" 200 42591 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Safari/605.1.15"


192.168.1.40 - - [18/May/2021:15:45:11 +0000] "GET /core/l10n/fr.js?v=fd2e34f8-0 HTTP/1.1" 200 17868 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Safari/605.1.15"


192.168.1.40 - - [18/May/2021:15:45:11 +0000] "GET /core/img/logo/logo.svg?v=1 HTTP/1.1" 200 856 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Safari/605.1.15"


192.168.1.40 - - [18/May/2021:15:45:11 +0000] "GET /js/core/merged-template-prepend.js?v=fd2e34f8-0 HTTP/1.1" 200 1828 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Safari/605.1.15"


192.168.1.40 - - [18/May/2021:15:45:11 +0000] "GET /core/js/dist/main.js?v=fd2e34f8-0 HTTP/1.1" 200 462747 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Safari/605.1.15"


192.168.1.40 - - [18/May/2021:15:45:12 +0000] "GET /core/img/favicon.ico HTTP/1.1" 200 3777 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Safari/605.1.15"


127.0.0.1 - - [18/May/2021:15:45:17 +0000] "OPTIONS * HTTP/1.0" 200 126 "-" "Apache/2.4.38 (Debian) PHP/7.4.19 (internal dummy connection)"


127.0.0.1 - - [18/May/2021:15:45:18 +0000] "OPTIONS * HTTP/1.0" 200 126 "-" "Apache/2.4.38 (Debian) PHP/7.4.19 (internal dummy connection)"


127.0.0.1 - - [18/May/2021:15:45:19 +0000] "OPTIONS * HTTP/1.0" 200 126 "-" "Apache/2.4.38 (Debian) PHP/7.4.19 (internal dummy connection)"


192.168.1.40 - - [18/May/2021:15:51:48 +0000] "GET /index.php/csrftoken HTTP/1.1" 200 1825 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36"


192.168.1.40 - - [18/May/2021:15:56:27 +0000] "GET /index.php/csrftoken HTTP/1.1" 200 1829 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36"


[Tue May 18 15:59:37.373325 2021] [access_compat:error] [pid 41] [client 209.141.47.35:42156] AH01797: client denied by server configuration: /var/www/html/config/getuser


209.141.47.35 - - [18/May/2021:15:59:37 +0000] "GET /config/getuser?index=0 HTTP/1.1" 403 3548 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:76.0) Gecko/20100101 Firefox/76.0"


192.168.1.40 - - [18/May/2021:16:00:12 +0000] "GET /index.php/csrftoken HTTP/1.1" 200 1829 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Safari/605.1.15"


192.168.1.40 - - [18/May/2021:16:00:56 +0000] "GET / HTTP/1.1" 200 1828 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36"


192.168.1.40 - - [18/May/2021:16:00:57 +0000] "GET /core/img/favicon.ico HTTP/1.1" 200 3776 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36"


192.168.1.40 - - [18/May/2021:16:06:48 +0000] "GET /index.php/csrftoken HTTP/1.1" 200 1828 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36"


192.168.1.40 - - [18/May/2021:16:15:58 +0000] "GET /index.php/csrftoken HTTP/1.1" 200 1827 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36"


192.168.1.40 - - [18/May/2021:16:22:05 +0000] "GET /index.php/csrftoken HTTP/1.1" 200 1829 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36"


192.168.1.40 - - [18/May/2021:16:31:01 +0000] "GET /index.php/csrftoken HTTP/1.1" 200 1830 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36"


178.46.210.145 - - [18/May/2021:16:32:16 +0000] "GET / HTTP/1.1" 200 3348 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36"


192.168.1.40 - - [18/May/2021:16:37:05 +0000] "GET /index.php/csrftoken HTTP/1.1" 200 1826 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36"


193.93.62.130 - - [18/May/2021:16:45:01 +0000] "\x03" 400 0 "-" "-"


192.168.1.40 - - [18/May/2021:16:45:58 +0000] "GET /index.php/csrftoken HTTP/1.1" 200 1827 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36"


Have you found a solution? I seem to have a similar problem: Internal Server Error after uploading and deleting a lot of files + changing the trash retention configuration

I had a similar issue, also producing the error message “ini_set(): Headers already sent. You cannot change the session module’s ini settings at this time”

After doing a long search for the cause, I found that this happens if some code prematurely produces output that is directed towards the http client (e.g. an error message that is not properly handled) e.g.: How to fix "Headers already sent" error in PHP - Stack Overflow

In my case, it was a module (tables) that produced an error message related to composer: “Your Composer dependencies require a PHP version “>= 8.0.0”. You are running 7.4.33” But this will be most likely different in your case.

In my case, I found this message event before the “” statement on the page served by nextcloud.

To fix it, I searched the code for the relevant message. As mentioned, in my case it was the tables app. I was then able to disable the app with the command:

./occ app:disable table

This fixed the issue in my case.