Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems including DB.php

Status
Not open for further replies.

TyzA

Programmer
Jan 7, 2002
86
BE
Hi,

My website was runing fine for a few months but no all of a sudden i get following error while accessing my database:
Warning: main(DB.php): failed to open stream: No such file or directory in /home/w20998/public_html/test.php on line 5

Fatal error: main(): Failed opening required 'DB.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/w20998/public_html/test.php on line 5


I have following line at the top of my code:
require_once('DB.php');

I checked with my administrators and they told me the DB.php file is available and accessible at following locations:
/usr/local/lib/php/DB.php
/usr/lib/php/DB.php


But when I try to use these absolute paths I still get the same error.

I looked around on the net and found the following to add at the top of my code:
ini_set('include_path', ini_get('include_path'));

But still nothing.

Is there anybody who has an idea, because I'm getting out of them.

Thanx alot for your help,
:Tijs




 
They told me they checked the permissions.
So I guess this should be alright
 
I dunno. It should have worked even without the absolute pathnames. It sounds to me like your sysadmins need to do some more digging.

They changed something recently.

Want the best answers? Ask the best questions!

TANSTAAFL!!
 
OK This problem is solved.
There was no permission to access the directories.

But now I get a different error.
I still use the same code as I was before (and which was working) but now I get following error:
DB Error: not found

Here is my code how I create my connection:
<?php

require_once('DB.php');
include_once('utils.inc');

# get the values from the ini file
$usrname = utils::getIniFileValues("dbusr");
$pwd = utils::getIniFileValues("dbpwd");
$host = utils::getIniFileValues("dbhost");
$dbname = utils::getIniFileValues("dbname");

# create the connect string
$connect = "mysql://$usrname:$pwd@$host/$dbname";

# establish the connection
$db = DB::connect($connect);

if (DB::iserror($db) ){
die ("Error while setting up the DB connection (check ini-file): " . $db->getMessage());
}

?>


With this piece of code (another php file), I execute a sql statement:

require_once('dbConnect.php');
...
$sql = "select menu_key, menu_name, menu_url, menu_topic from navigation where menu_type = 'MAIN' and par_menu_id = 0 and lang_id = '$lang_id' order by menu_id";

$q = $db->query($sql);
if (DB::iserror($q)){
die($q->getMessage());
}

while ($q->fetchInto($row)){

$menu = utils::replaceChar(" ", "_", $row[3]);

if ($row[0] == $menu_id){
$style = "navMainSel";
$image = $menu._.$lang_id;
}
else {
$style = "navMain";
}
?>

<td class="sideSingle"></td>
<td class="<?= $style ?>"><a class="navMain" onmouseover="show('<?= $menu ?>')" onmouseout=setTimeout("hide('<?= $menu ?>');",5000) href="<?= $row[2] ?><?= $lang_id ?>"><?= $row[1] ?></a></td>

<?php
}
?>
...


Does anybody have any sugestions?
Thanx
-T
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top