Does anyone have any experience using berkeley db

2019-05-12 22:02发布

I have to access and write to some berkeley db files that other applications share.

I really haven't found anything out there about using this with PHP. It really doesn't seem very popular.

Does anyone have any links or resources that I might be able to use to get things rolling?

Thanks!

2条回答
Root(大扎)
2楼-- · 2019-05-12 22:59

Berkley DB isn't really meant for multi-user access. It is much better for an embedded database that is accessed by one process.

PHP processes run asyncronously on the web site. This means a php script accessing a Berkley DB has to rely on file locking to handle concurrent access.

This is very inefficient. thus no BDB support in php.

If you want to use BDB in a multi-user environment, you should write a web service in perl/c/python/etc that talks to BDB, and accepts connections from php. Or you could just use a real db server like mysql, postgres or something and save yourself the headache.

查看更多
Evening l夕情丶
3楼-- · 2019-05-12 23:06

Isn't this what the dba functions are for?
http://php.net/manual/en/book.dba.php

I've had some code some years ago with that. Didn't use it much however, because it was a somewhat inefficient data store. And it seems kind of pointless in the light of SQLite now anyway. But btw: http://schlueters.de/blog/archives/134-Berkeley-DB-5-and-PHP.html

查看更多
登录 后发表回答