CascadiaPHP 2024


(PHP 4, PHP 5, PHP 7, PHP 8)

dba_popenOpen database persistently


    string $path,
    string $mode,
    ?string $handler = null,
    int $permission = 0644,
    int $map_size = 0,
    ?int $flags = null
): resource|false

dba_popen() establishes a persistent database instance for path with mode using handler.



Commonly a regular path in your filesystem.


It is r for read access, w for read/write access to an already existing database, c for read/write access and database creation if it doesn't currently exist, and n for create, truncate and read/write access.


The name of the handler which shall be used for accessing path. It is passed all optional parameters given to dba_popen() and can act on behalf of them. If handler is null, then the default handler is invoked.


Optional int parameter which is passed to the driver. It has the same meaning as the permissions parameter of chmod(), and defaults to 0644.

The db1, db2, db3, db4, dbm, gdbm, ndbm, and lmdb drivers support the permission parameter.


Optional int parameter which is passed to the driver. Its value should be a multiple of the page size of the OS, or zero, to use the default mapsize.

The lmdb driver accepts the map_size parameter.


Allows to pass flags to the DB drivers. Currently, only LMDB with DBA_LMDB_USE_SUB_DIR and DBA_LMDB_NO_SUB_DIR are supported.


Returns a positive handle on success 或者在失败时返回 false.


false is returned and an E_WARNING level error is issued when handler is null, but there is no default handler.


版本 说明
8.2.0 flags is added.
8.1.0 handler is now nullable.
7.3.14, 7.4.2 The lmdb driver now supports an additional map_size parameter.


add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top