YateAdmin Headers Sent Fix

From Yate Documentation
(Difference between revisions)
Jump to: navigation, search
(Created page with " I installed Yate, PostgreSQL and YateAdmin. I use lighttpd as a webserver, and PHP5. Initially I came across some error messages of the sort: "Cannot modify header informa...")
 
(Update)
 
(9 intermediate revisions by one user not shown)
Line 1: Line 1:
 +
 +
'''Note:''' If you want an interface for Yate for a basic setup you can probably use [http://freesentral.com FreeSentral]. It offers all the features from YateAdmin and a lot of new ones.
  
 
I installed Yate, PostgreSQL and YateAdmin. I use lighttpd as a webserver, and PHP5.
 
I installed Yate, PostgreSQL and YateAdmin. I use lighttpd as a webserver, and PHP5.
Line 6: Line 8:
 
  "Cannot modify header information - headers already sent by"
 
  "Cannot modify header information - headers already sent by"
  
The problem, it seems, is that some data is already being passed out by the webserver, which makes header modification impossible. Maybe Apache, which most people probably use, handles things differently. (Perhaps you could also integrate this fix into the distribution, Null Team?) For more information see this website: http://www.siteinaweek.com/howto/headerproblems/headerproblems.html
+
The problem, it seems, is that some data is already being passed out by the webserver, which makes header modification impossible. Maybe Apache, which most people probably use, handles things differently.
  
 
Essentially, to fix the problem, modify two files and insert ob_start(); and ob_end_flush(); as shown below.  
 
Essentially, to fix the problem, modify two files and insert ob_start(); and ob_end_flush(); as shown below.  
  
index.php
+
  index.php
*******
+
  *******
<?
+
  <?
ob_start();
+
  ob_start();
/*
+
  /*
* This file is part of the YateAdmin Project http://yateadmin.null.ro
+
  * This file is part of the YateAdmin Project http://yateadmin.null.ro
(...)
+
  (...)
  else
+
  else
      if ($username || $password)
+
        if ($username || $password)
              $login = "<h3>Wrong login<h3>";
+
                $login = <nowiki>"<h3>Wrong login<h3>"</nowiki>;
      else
+
        else
              session_unset();
+
                session_unset();
 +
 
 +
  ob_end_flush();
 +
  ?>
 +
 
 +
  main.php
 +
  *******
 +
  <?
 +
  ob_start();
 +
  /*
 +
  * This file is part of the YateAdmin Project http://yateadmin.null.ro
 +
  (...)
 +
  if (isset($_GET['skin']))
 +
    $_SESSION['skin']=$_GET['skin'];  
 
   
 
   
ob_end_flush();
+
  ob_end_flush();
?>
+
  ?>
  
main.php
+
Cheers, Max
*******
+
<?
+
ob_start();
+
/*
+
* This file is part of the YateAdmin Project http://yateadmin.null.ro
+
(...)
+
if (isset($_GET['skin']))
+
  $_SESSION['skin']=$_GET['skin'];
+
  
ob_end_flush();
+
===Update===
?>
+
This type of problem can also be fixed by enabling output_buffering from php.ini or .htaccess file. Still, this is a workaround and the code should be fixed instead of changing php settings.
  
Cheers, Max
+
 
 +
'''See also:'''
 +
* http://freesentral.com
 +
 
 +
[[Category:Debug]]

Latest revision as of 10:37, 4 November 2013

Note: If you want an interface for Yate for a basic setup you can probably use FreeSentral. It offers all the features from YateAdmin and a lot of new ones.

I installed Yate, PostgreSQL and YateAdmin. I use lighttpd as a webserver, and PHP5.

Initially I came across some error messages of the sort:

"Cannot modify header information - headers already sent by"

The problem, it seems, is that some data is already being passed out by the webserver, which makes header modification impossible. Maybe Apache, which most people probably use, handles things differently.

Essentially, to fix the problem, modify two files and insert ob_start(); and ob_end_flush(); as shown below.

 index.php
 *******
 <?
 ob_start();
 /*
 * This file is part of the YateAdmin Project http://yateadmin.null.ro
 (...)
  else
       if ($username || $password)
               $login = "<h3>Wrong login<h3>";
       else
               session_unset();
 
 ob_end_flush();
 ?>
  
 main.php
 *******
 <?
 ob_start();
 /*
 * This file is part of the YateAdmin Project http://yateadmin.null.ro
 (...)
 if (isset($_GET['skin']))
   $_SESSION['skin']=$_GET['skin']; 

 ob_end_flush();
 ?>

Cheers, Max

[edit] Update

This type of problem can also be fixed by enabling output_buffering from php.ini or .htaccess file. Still, this is a workaround and the code should be fixed instead of changing php settings.


See also:

Personal tools
Namespaces

Variants
Actions
Preface
Configuration
Administrators
Developers