dba_popen
(PHP 4, PHP 5, PHP 7, PHP 8)
Open database persistently
Description
dba_popen() establishes a persistent database instance for path with mode using handler.
Parameters
pathCommonly a regular path in your filesystem.
modeIt is
rfor read access,wfor read/write access to an already existing database,cfor read/write access and database creation if it doesn't currently exist, andnfor create, truncate and read/write access.handlerThe name of the handler which shall be used for accessing
path. It is passed all optional parameters given todba_popen()and can act on behalf of them. Ifhandleris null, then the default handler is invoked.permissionOptional Integer parameter which is passed to the driver. It has the same meaning as the
permissionsparameter ofchmod(), and defaults to0644.The
db1,db2,db3,db4,dbm,gdbm,ndbm, andlmdbdrivers support thepermissionparameter.map_sizeOptional Integer 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
lmdbdriver accepts themap_sizeparameter.flagsAllows to pass flags to the DB drivers. Currently, only LMDB with
DBA_LMDB_USE_SUB_DIRandDBA_LMDB_NO_SUB_DIRare supported.
Return Values
Returns a Dba\Connection instance on successFalseforfailure.
Errors/Exceptions
false is returned and an E_WARNING level error is issued when handler is null, but there is no default handler.
Changelog
| Version | Description |
|---|---|
| 8.4.0 | Returns a Dba\Connection instance now; previously, a Resource was returned. |
| 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. |