The Best Cyprus Community

Skip to content


PHP Database Problem

Feel free to talk about anything that you want.

Postby Sega » Wed Oct 10, 2007 9:55 pm

Ye but why is there no handler?.... how I can I solve this.

gdbm stands for GNU database, but even when I try to use different compile options (e.g. db2, db3, dbm) it still comes up with the error.
User avatar
Sega
Contributor
Contributor
 
Posts: 895
Joined: Mon Mar 05, 2007 10:21 pm

Postby morhekil » Wed Oct 10, 2007 10:00 pm

your choice of handlers can be limited by your configuration and compilation options. Execute a simple script <? phpinfo(); ?> and check DBA section in it's output - it should list all available handlers, you have to pick one of them.
morhekil
Member
Member
 
Posts: 66
Joined: Sun Jul 03, 2005 4:31 pm
Location: Nicosia

Postby Sega » Wed Oct 10, 2007 10:15 pm

I got the following information from phpinfo() to do with DBA.

DBA support enabled
Supported handlers cdb cdb_make db3 inifile flatfile.

I changed the database to db3, since it's listed, but I get this error.

"Warning: dba_open(./data/products) [function.dba-open]: failed to open stream: No such file or directory in C:\Program Files\EasyPHP 2.0b1\www\test.php on line 11
Could not open the database in question"

What do you advise me to do?
User avatar
Sega
Contributor
Contributor
 
Posts: 895
Joined: Mon Mar 05, 2007 10:21 pm

Postby Get Real! » Wed Oct 10, 2007 10:19 pm

But isn't this an invalid path? "./data/products" :?

Or do the period and forward slashes mean something special in PHP?

. = ROOT DIRECTORY perhaps ?

/ = on the network perhaps

:?
User avatar
Get Real!
Forum Addict
Forum Addict
 
Posts: 48333
Joined: Mon Feb 26, 2007 12:25 am
Location: Nicosia

Postby Sega » Wed Oct 10, 2007 10:24 pm

To be honest I don't think there is a problem with the path, I am certain there is a problem locally. I am new on the subject, thats why I am having such problems early on.
User avatar
Sega
Contributor
Contributor
 
Posts: 895
Joined: Mon Mar 05, 2007 10:21 pm

Postby morhekil » Wed Oct 10, 2007 10:24 pm

./ means something in Unix-like OSes, in Win it's better to change you DB path to something like "C:\Temp" or whatever exists there in your filesystem
morhekil
Member
Member
 
Posts: 66
Joined: Sun Jul 03, 2005 4:31 pm
Location: Nicosia

Postby Sega » Wed Oct 10, 2007 10:38 pm

Well what I have tried now is to create the folders on the C drive and specifically go for those within dba_open, however it says something about system rights. Well the exact message is:

"Warning: dba_open(./) [function.dba-open]: failed to open stream: Permission denied in C:\Program Files\EasyPHP 2.0b1\www\test.php on line 11
Could not open the database in question"

I am now using db3, instead of the previous gdbm because it was not listed in phpinfo. Whats the easiest way to solve this problem, how can I change the rights, I am unable to do it manually by going on properties of the folder.
User avatar
Sega
Contributor
Contributor
 
Posts: 895
Joined: Mon Mar 05, 2007 10:21 pm

Postby raymanuva » Wed Oct 10, 2007 10:45 pm

what book is this damn it? why would you wanna learn PHP from upside down? get to PHP/MYSQL instead...
User avatar
raymanuva
Regular Contributor
Regular Contributor
 
Posts: 1102
Joined: Sun May 21, 2006 7:28 pm

Postby Get Real! » Wed Oct 10, 2007 10:49 pm

I'm going to tell you for the last time because I don’t want to spend the rest of my evening with this…

Your program is trying to ACCESS a file on the hard disk.

I suspect that the file's name is gdbm so if you have it copy it to C:\

Now change the path of the first parameter of the function dba_open to match...

Try each of these in this order…

1. $dbh = dba_open(":\’", "C", "gdbm")
2. $dbh = dba_open("C:\’", "", "gdbm")

Good luck.

Ps: You need to master DOS (the bare bones file system) BEFORE you start programming.
User avatar
Get Real!
Forum Addict
Forum Addict
 
Posts: 48333
Joined: Mon Feb 26, 2007 12:25 am
Location: Nicosia

Postby Sega » Wed Oct 10, 2007 10:51 pm

The book is titled "Sams Teach Yourself PHP in 24 Hours" and it's by "Matt Zandstra". The book also cover PHP/MYSQL.
User avatar
Sega
Contributor
Contributor
 
Posts: 895
Joined: Mon Mar 05, 2007 10:21 pm

PreviousNext

Return to General Chat

Who is online

Users browsing this forum: No registered users and 1 guest