Posted by:
Gunder
(---.hsd1.ut.comcast.net)
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"
return 0;
}
return $db;
}
function OpenDatabase($thePath, $theType)
{
$db = dba_open($thePath, "r", $theType);
if (!$db)
{
printf("Could not open the database"
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?