[doc-en] master: pdo_sqlite: Document file: URI filenames in DSN
| From: | Jakub Vrana | Date: | Thu, 05 Nov 2026 14:42:08 +0000 |
| Subject: | [doc-en] master: pdo_sqlite: Document file: URI filenames in DSN | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-23919@lists.php.net to get a copy of this message | ||
Author: Jakub Vrana (vrana)
Date: 2026-11-05T15:41:02+01:00
Commit: https://github.com/php/doc-en/commit/0075c0fad0709b16d96ebbbecd69191fe9e835f1
Raw diff: https://github.com/php/doc-en/commit/0075c0fad0709b16d96ebbbecd69191fe9e835f1.diff
pdo_sqlite: Document file: URI filenames in DSN
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Changed paths:
M reference/pdo_sqlite/reference.xml
Diff:
diff --git a/reference/pdo_sqlite/reference.xml b/reference/pdo_sqlite/reference.xml
index bb7d982897dd..0c23026ab991 100644
--- a/reference/pdo_sqlite/reference.xml
+++ b/reference/pdo_sqlite/reference.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
- <reference xml:id="ref.pdo-sqlite" xmlns="http://docbook.org/ns/docbook">
+ <reference xml:id="ref.pdo-sqlite" xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink">
<?phpdoc extension-membership="bundledexternal" ?>
<title>SQLite PDO Driver (PDO_SQLITE)</title>
<titleabbrev>SQLite PDO Driver</titleabbrev>
@@ -54,6 +54,26 @@
to the DSN prefix.
</para>
</listitem>
+ <listitem>
+ <simpara>
+ A DSN starting with <literal>file:</literal> after the DSN prefix
+ is passed to SQLite unchanged as a
+ <link xlink:href="&url.sqlite;uri.html">URI filename</link>.
+ Its query parameters set options, e.g. <literal>mode=ro</literal>
+ opens the database read-only, and unknown parameters are ignored.
+ URI filenames are not available if
+ <link linkend="ini.open-basedir">open_basedir</link> is set.
+ </simpara>
+ <caution>
+ <simpara>
+ A URI filename can name any file regardless of the end of the DSN,
+ e.g. <literal>sqlite:file:/var/www/data.php?x=.db</literal> opens
+ <filename>/var/www/data.php</filename>.
+ A DSN built from user input should therefore not be allowed to
+ start with <literal>file:</literal>.
+ </simpara>
+ </caution>
+ </listitem>
<listitem>
<para>
If the DSN consists of the DSN prefix only, a temporary database is used,
@@ -67,6 +87,27 @@
</variablelist>
</para>
</refsect1>
+ <refsect1 role="changelog">
+ &reftitle.changelog;
+ <informaltable>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>&Version;</entry>
+ <entry>&Description;</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>8.1.0</entry>
+ <entry>
+ Added support for <literal>file:</literal> URI filenames.
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
+ </refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
@@ -78,6 +119,7 @@
<programlisting>
<![CDATA[
sqlite:/opt/databases/mydb.sq3
+sqlite:file:/opt/databases/mydb.sq3?mode=ro
sqlite::memory:
sqlite:
]]>