Weird permissions error
Posted by: Gunder (---.hsd1.ut.comcast.net)
Date: January 19, 2008 02:30AM

Hello everyone, I'm using Wamp5 1.7.3 on WinXP. I'm learning about Non-Relational Databases but I'm getting some weird permissions error and I don't know why. I should mention that my internet isn't working at home and I'm on a friends computer right now so hopefully I wrote down all the information you will need to help. Here is the code I'm using, it should be easy enough to understand.

<?php
// Set the db parameters
$dbPath = "myDatabase.db";
$dbType = "db3";

function CreateDatabase($thePath, $theType)
{
	$db = dba_open($thePath, "c", $theType);
	if(!$db)
	{
		printf("Could not create the database"winking smiley;
		return 0;
	}
	
	return $db;
}

function OpenDatabase($thePath, $theType)
{
	$db = dba_open($thePath, "r", $theType);
	if (!$db)
	{
		printf("Could not open the database"winking smiley;
		return 0;
	}
	
	return $db;
}

// Open the database, if it isn't there, create it.
$db = OpenDatabase($dbPath, $dbType);
if(!$db)
{
	$db = CreateDatabase($dbPath, $dbType);
	if(!$db)
	{
		exit;
	}
}

?>

Here is the error I'm getting.

error:
Warning: dba_open(myDatabase.db,r) [function.dba-open]: Driver initialization failed for handler: db3: Permission denied in C:\wamp\www\DBAtest\DBAtest.php on line 20
Could not open the database
Warning: dba_open(myDatabase.db,c) [function.dba-open]: Driver initialization failed for handler: db3: Permission denied in C:\wamp\www\DBAtest\DBAtest.php on line 8
Could not create the database

The error tells me that I'm having permission problems but when I open up PHPmyadmin and go into the Privileges tab it says that the user root on local host has all privileges. The weird thing is that the file myDatabase.db is actually created in the directory but I'm getting these errors. I've never done anything with reading or writing files before this. Am I doing something horribly wrong?

I did just notice that a new version of Wamp was released so I'll update to that version, but will that fix the problem that I'm having or is something set wrong with my code/permissions?

Options: ReplyQuote
Re: Weird permissions error
Posted by: yfastud (Moderator)
Date: January 19, 2008 03:32AM


Options: ReplyQuote
Re: Weird permissions error
Posted by: Gunder (---.hsd1.ut.comcast.net)
Date: January 19, 2008 07:29PM

So I have to use sqlitmanager to create the database? Why can't I use that code that I wrote? I installed the latest version of wamp and I opened up sqlitemanager and it looks like the only version it will let me make is 2, and I need version 3 for what I'm trying to do.

Options: ReplyQuote
Re: Weird permissions error
Posted by: yfastud (Moderator)
Date: January 19, 2008 08:53PM


Options: ReplyQuote
Re: Weird permissions error
Posted by: Gunder (216.126.224.---)
Date: January 20, 2008 11:55PM

Well, I go into sqlitemanager and the radio option for 3 is grayed out. When I look at the DBA section in PHPinfo it has DB3 listed. I just don't understand what it isn't working or where I need to look to try and figure it out.

Options: ReplyQuote
Re: Weird permissions error
Posted by: yfastud (Moderator)
Date: January 22, 2008 03:05AM

Well, it is grey out until you create/import the db;then, you can set to sqlite3; for example, sqlite db is working on my websites here:

[test.jlbn.com]

Have fun,

FREE One A Day
FREE Photo
FREE Games
FREE Websites
FREE Portable GPS
FREE WAMP Guides

Options: ReplyQuote


Sorry, only registered users may post in this forum.