[php-src] Issue #20076: SQLite: PDOException: open_basedir prohibits opening :memory:?cache=shared
| From: | AnrDaemon | Date: | Mon, 06 Oct 2025 12:44:23 +0000 |
| Subject: | [php-src] Issue #20076: SQLite: PDOException: open_basedir prohibits opening :memory:?cache=shared | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-250998@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/20076
Author: AnrDaemon
### Description
The following code:
```php
#!/usr/bin/env php
<?php
print "open_basedir: ";
var_dump(ini_get("open_basedir"));
print "\n";
$db = new \PDO("sqlite::memory:?cache=shared", null, null, [
\PDO::ATTR_PERSISTENT => true,
\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION,
\PDO::ATTR_EMULATE_PREPARES => false,
\PDO::ATTR_DEFAULT_FETCH_MODE => \PDO::FETCH_ASSOC,
]);
```
Resulted in this output:
```
$ ./sqlite-nomemory.php
open_basedir: string(0) ""
PHP Fatal error: Uncaught PDOException: open_basedir prohibits opening :memory:?cache=shared in
…\sqlite-nomemory.php:8
Stack trace:
#0 …\sqlite-nomemory.php(8): PDO->__construct('sqlite::memo
ry:...', NULL, Object(SensitiveParameterValue), Array)
#1 {main}
thrown in …\sqlite-nomemory.php on line 8
```
But I expected this output instead:
```
I expected no error. Frankly, the code should just work.
```
### PHP Version
```plain
PHP 8.4.13 (cli) (built: Sep 23 2025 15:17:09) (ZTS Visual C++ 2022 x64)
Copyright (c) The PHP Group
Zend Engine v4.4.13, Copyright (c) Zend Technologies
with Zend OPcache v8.4.13, Copyright (c), by Zend Technologies
```
### Operating System
Windows 10