Failed to start the session because headers have already been sent by "/home/httpd/vhosts/harmoniemusik-wald.ch/httpdocs/libraries/vendor/joomla/application/src/AbstractWebApplication.php" at line 404. (500 Whoops, looks like something went wrong.)

RuntimeException

HTTP 500 Whoops, looks like something went wrong.

Failed to start the session because headers have already been sent by "/home/httpd/vhosts/harmoniemusik-wald.ch/httpdocs/libraries/vendor/joomla/application/src/AbstractWebApplication.php" at line 404.

Exception

RuntimeException

  1. if ($this->isActive()) {
  2. throw new \RuntimeException('Failed to start the session: already started by PHP.');
  3. }
  4. if (ini_get('session.use_cookies') && headers_sent($file, $line)) {
  5. throw new \RuntimeException(
  6. sprintf('Failed to start the session because headers have already been sent by "%s" at line %d.', $file, $line)
  7. );
  8. }
  9. if (!session_start()) {
  1. $this->setId($session_clean);
  2. $cookie->set($session_name, '', ['expires' => time() - 3600 ]);
  3. }
  4. }
  5. parent::start();
  6. // Try loading data from the session
  7. if (!empty($_SESSION['joomla'])) {
  8. $this->data = unserialize(base64_decode($_SESSION['joomla']));
  9. }
  1. {
  2. if ($this->isStarted()) {
  3. return;
  4. }
  5. $this->store->start();
  6. $this->setState(SessionState::ACTIVE);
  7. // Initialise the session
  8. $this->setCounter();
  1. * @since 1.0
  2. */
  3. public function has($name)
  4. {
  5. if (!$this->isActive()) {
  6. $this->start();
  7. }
  8. return $this->store->has($name);
  9. }
  1. $name = $args[2] . '.' . $name;
  2. }
  3. }
  4. if (parent::has($name)) {
  5. // Parent is used because of b/c, can be changed in Joomla 6
  6. return parent::get($name, $default);
  7. }
  8. /*
  1. */
  2. public function getMessageQueue($clear = false)
  3. {
  4. // For empty queue, if messages exists in the session, enqueue them.
  5. if (!\count($this->messageQueue)) {
  6. $sessionQueue = $this->getSession()->get('application.queue', []);
  7. if ($sessionQueue) {
  8. $this->messageQueue = $sessionQueue;
  9. $this->getSession()->set('application.queue', []);
  10. }
  1. // Boolean short–circuit evaluation means this returns fast false when $isSite is false.
  2. return $isSite
  3. && $isGET
  4. && $app->getIdentity()->guest
  5. && empty($app->getMessageQueue());
  6. }
  7. /**
  8. * Get the cache controller
  9. *
  1. *
  2. * @since 1.5
  3. */
  4. public function onAfterRespond(AfterRespondEvent $event): void
  5. {
  6. if (!$this->appStateSupportsCaching() || $this->getCacheController()->getCaching() === false) {
  7. return;
  8. }
  9. // Saves current page in cache.
  10. $this->getCacheController()->store($this->getApplication()->getBody(), $this->getCacheKey());
  1. foreach ($this->listeners[$event->getName()] as $listener) {
  2. if ($event->isStopped()) {
  3. return $event;
  4. }
  5. $listener($event);
  6. }
  7. }
  8. return $event;
  9. }
  1. $dispatcher = $this->getDispatcher();
  2. } catch (\UnexpectedValueException $exception) {
  3. return null;
  4. }
  5. return $dispatcher->dispatch($eventName, $event ?: new ApplicationEvent($eventName, $this));
  6. }
  7. /**
  8. * Method to run the application routines.
  9. *
AbstractApplication->dispatchEvent('onAfterRespond', object(AfterRespondEvent)) in /home/httpd/vhosts/harmoniemusik-wald.ch/httpdocs/libraries/src/Application/CMSApplication.php (line 347)
  1. // Send the application response.
  2. $this->respond();
  3. // Trigger the onAfterRespond event.
  4. $this->dispatchEvent(
  5. 'onAfterRespond',
  6. new AfterRespondEvent('onAfterRespond', ['subject' => $this])
  7. );
  8. }
  1. // Set the application as global app
  2. \Joomla\CMS\Factory::$application = $app;
  3. // Execute the application.
  4. $app->execute();
require_once('/home/httpd/vhosts/harmoniemusik-wald.ch/httpdocs/includes/app.php') in /home/httpd/vhosts/harmoniemusik-wald.ch/httpdocs/index.php (line 51)
  1. // ... die
  2. die();
  3. }
  4. // Run the application - All executable code should be triggered through this file
  5. require_once __DIR__ . '/includes/app.php';

Stack Trace

RuntimeException
RuntimeException:
Failed to start the session because headers have already been sent by "/home/httpd/vhosts/harmoniemusik-wald.ch/httpdocs/libraries/vendor/joomla/application/src/AbstractWebApplication.php" at line 404.

  at /home/httpd/vhosts/harmoniemusik-wald.ch/httpdocs/libraries/vendor/joomla/session/src/Storage/NativeStorage.php:454
  at Joomla\Session\Storage\NativeStorage->start()
     (/home/httpd/vhosts/harmoniemusik-wald.ch/httpdocs/libraries/src/Session/Storage/JoomlaStorage.php:313)
  at Joomla\CMS\Session\Storage\JoomlaStorage->start()
     (/home/httpd/vhosts/harmoniemusik-wald.ch/httpdocs/libraries/vendor/joomla/session/src/Session.php:396)
  at Joomla\Session\Session->start()
     (/home/httpd/vhosts/harmoniemusik-wald.ch/httpdocs/libraries/vendor/joomla/session/src/Session.php:327)
  at Joomla\Session\Session->has('application.queue')
     (/home/httpd/vhosts/harmoniemusik-wald.ch/httpdocs/libraries/src/Session/Session.php:194)
  at Joomla\CMS\Session\Session->get('application.queue', array())
     (/home/httpd/vhosts/harmoniemusik-wald.ch/httpdocs/libraries/src/Application/CMSApplication.php:611)
  at Joomla\CMS\Application\CMSApplication->getMessageQueue()
     (/home/httpd/vhosts/harmoniemusik-wald.ch/httpdocs/plugins/system/cache/src/Extension/Cache.php:238)
  at Joomla\Plugin\System\Cache\Extension\Cache->appStateSupportsCaching()
     (/home/httpd/vhosts/harmoniemusik-wald.ch/httpdocs/plugins/system/cache/src/Extension/Cache.php:382)
  at Joomla\Plugin\System\Cache\Extension\Cache->onAfterRespond(object(AfterRespondEvent))
     (/home/httpd/vhosts/harmoniemusik-wald.ch/httpdocs/libraries/vendor/joomla/event/src/Dispatcher.php:454)
  at Joomla\Event\Dispatcher->dispatch('onAfterRespond', object(AfterRespondEvent))
     (/home/httpd/vhosts/harmoniemusik-wald.ch/httpdocs/libraries/vendor/joomla/application/src/AbstractApplication.php:99)
  at Joomla\Application\AbstractApplication->dispatchEvent('onAfterRespond', object(AfterRespondEvent))
     (/home/httpd/vhosts/harmoniemusik-wald.ch/httpdocs/libraries/src/Application/CMSApplication.php:347)
  at Joomla\CMS\Application\CMSApplication->execute()
     (/home/httpd/vhosts/harmoniemusik-wald.ch/httpdocs/includes/app.php:58)
  at require_once('/home/httpd/vhosts/harmoniemusik-wald.ch/httpdocs/includes/app.php')
     (/home/httpd/vhosts/harmoniemusik-wald.ch/httpdocs/index.php:51)