1
ChadK
Output already started?
  • 2004/8/19 15:38

  • ChadK

  • Quite a regular

  • Posts: 242

  • Since: 2004/7/9 1


On some pages I get the following error:
Quote:
Warning: Cannot modify header information - headers already sent by (output started at /..../includes/config.php:419) in /..../libs/auth.php on line 134



This is the code for the page that is indicated in the error but the line number is simply the last line of the file:
Quote:
/*
--------------------------------------------------------------------------------
PhpDig Version 1.8.x
This program is provided under the GNU/GPL license.
See the LICENSE file for more information.
All contributors are listed in the CREDITS file provided with this package.
PhpDig Website : http://www.phpdig.net/
--------------------------------------------------------------------------------
*/

// Connection configuration
if (!defined('PHPDIG_DB_NAME')) { // do not change this line

define('PHPDIG_DB_PREFIX','');
define('PHPDIG_DB_HOST','localhost');
define('PHPDIG_DB_USER','xxxx');
define('PHPDIG_DB_PASS','xxxx');
define('PHPDIG_DB_NAME','xxxx');

} // do not change this line

//connection to the MySql server
$id_connect = @mysql_connect(PHPDIG_DB_HOST,PHPDIG_DB_USER,PHPDIG_DB_PASS);
if (!$id_connect) {
die("Unable to connect to database : Check the connection script.\n");
}

//Select DataBase
$db_select = @mysql_select_db(PHPDIG_DB_NAME,$id_connect);
if (!$db_select) {
die("Unable to select the database : Check the connection script.\n");
}
?>




This happens on various XOOPS pages as well, not just these phpdig pages.

2
Dave_L
Re: Output already started?
  • 2004/8/19 16:00

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


PHP automatically outputs the HTTP headers the first time the script does any output, unless the headers have already been output.

If an include-file (file accessed with include or require) that contains characters (including whitespace) outside of the brackets, those characters will be output when the file is included. If the HTTP headers have not yet been output, PHP will do that.

If HTTP headers are subsequently output explicitly with the header() function, then you'll get that "headers already sent" warning.


3
ChadK
Re: Output already started?
  • 2004/8/19 17:20

  • ChadK

  • Quite a regular

  • Posts: 242

  • Since: 2004/7/9 1


Thanks Dave, that's an excellent reply. I'll check the include files for white-space outside the as I'm sure that's the problem.

4
ChadK
Re: Output already started?
  • 2004/8/19 17:22

  • ChadK

  • Quite a regular

  • Posts: 242

  • Since: 2004/7/9 1


Dave, that was exactly it. Thank you!

Login

Who's Online

287 user(s) are online (198 user(s) are browsing Support Forums)


Members: 0


Guests: 287


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits