Error “Fatal error: Class ‘…’ not found”

Here is the file code

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<h3></h3>
<?php
session_start();
ob_start("ob_gzhandler");
//ob_implicit_flush();
ini_set('display_errors', 1);
error_reporting (E_ALL ^ E_NOTICE);
ini_set('display_errors','On');
define('CA', true);
require_once "config/db.conf.php";
require_once "config/conf.php";
$db = new db;
$db->query("select * from peoples where url=18");
while($line=$db->get_row()){
    echo '<ul><li class="first"><a href="'.$line['name'].'">'.$line['name'].'</a></li></ul>';
}
?> 
</body>
</html>

Writes such an error when starting through denver

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at X:\home\test1.ru\www\imeninnik.php:10) in X:\home\test1.ru\www\imeninnik.php on line 11

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at X:\home\test1.ru\www\imeninnik.php:10) in X:\home\test1.ru\www\imeninnik.php on line 11

Warning: Cannot modify header information - headers already sent by (output started at X:\home\test1.ru\www\imeninnik.php:10) in X:\home\test1.ru\www\config\conf.php on line 2

Fatal error: Class 'db' not found in X:\home\test1.ru\www\imeninnik.php on line 24

What does this mean? Has anyone experienced this?


Answer 1, authority 100%

The error session_start()is easy to fix – you just need to move the calls of the functions session_start();and ob_start("ob_gzhandler");to the very the beginning of the file. Because as soon as the html code is output, the headers will be automatically sent.

That’s why the class wasn’t found… I can’t see it either. Apparently, it is declared somewhere in another file – then you need to include this file using include. But most likely the class name db (and the line $db = new db;looks very strange – the variable and the class have the same name) is specified incorrectly. Look for the correct name where this code or template for it was taken.


Answer 2

session_start()is called before text is output to the browser.