Source of: /manual/en/sqlite.installation.php
<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/sqlite.setup.inc";
$setup = array (
'home' =>
array (
0 => 'index.php',
1 => 'PHP Manual',
),
'head' =>
array (
0 => 'UTF-8',
1 => 'en',
),
'this' =>
array (
0 => 'sqlite.installation.php',
1 => 'Installation',
),
'up' =>
array (
0 => 'sqlite.setup.php',
1 => 'Installing/Configuring',
),
'prev' =>
array (
0 => 'sqlite.requirements.php',
1 => 'Requirements',
),
'next' =>
array (
0 => 'sqlite.configuration.php',
1 => 'Runtime Configuration',
),
);
$setup["toc"] = $TOC;
$setup["parents"] = $PARENTS;
manual_setup($setup);
manual_header();
?>
<div id="sqlite.installation" class="section">
<h2 class="title">Installation</h2>
<p class="para">
As of PHP 5 this extension is enabled by default, so simply do not
disable it and it'll be available.
</p>
<div class="caution"><b class="caution">Caution</b>
<p class="para">
Do not use the PECL version of this extension, as it is
unmaintained. Always use the SQLite extension that comes with
the PHP sources even while compiling as shared. In this case
the sources are in <i>php-src-dir/ext/sqlite</i>
and the <a href="install.pecl.phpize.php" class="link">phpize</a>
method of building applies.
</p>
</div>
<p class="para">
Windows users must enable <var class="filename">php_sqlite.dll</var> inside
of <var class="filename">php.ini</var> in order to use these functions.
A <acronym title="Dynamic Link Library">DLL</acronym> for this
<acronym title="PHP Extension and Application Repository">PECL</acronym> extension is currently unavailable. See also the
<a href="install.windows.building.php" class="link">building on Windows</a>
section.
</p>
<p class="para">
Windows builds must also enable PDO because as of PHP 5.1.0 it depends
on it. So, <var class="filename">php.ini</var> will end up with something like this:
</p><div class="informalexample">
<div class="example-contents programlisting">
<div class="inicode"><pre class="inicode">extension=php_pdo.dll
extension=php_sqlite.dll</pre>
</div>
</div>
</div><p>
On Linux or Unix operating systems, if you build PDO as a shared
extension, you must build SQLite as a shared extension using the
<strong class="command">--with-sqlite=shared</strong> configure option.
</p>
<p class="para">
The PHP 5.0.x series of Windows builds enabled this extension by
default, where no <acronym title="Dynamic Link Library">DLL</acronym> file is necessary.
</p>
<p class="para">
SQLite 3 is supported through <a href="ref.pdo-sqlite.php" class="link">PDO SQLite</a>.
</p>
<blockquote><p><b class="note">Note</b>:
<b>Windows installation for unprivileged accounts</b><br />
On Windows operating systems, unprivileged accounts don't have the
<var class="varname">TMP</var> environment variable set by default. This will
make sqlite create temporary files in the windows directory, which is
not desirable. So, you should set the <var class="varname">TMP</var> environment
variable for the web server or the user account the web server is
running under. If Apache is your web server, you can accomplish this via
a <strong class="command">SetEnv</strong> directive in your <var class="filename">httpd.conf</var> file. For
example:
</p><div class="informalexample">
<div class="example-contents programlisting">
<div class="apache-confcode"><pre class="apache-confcode">SetEnv TMP c:/temp</pre>
</div>
</div>
</div><p>
If you are unable to establish this setting at the server
level, you can implement the setting in your script:
</p><div class="informalexample">
<div class="example-contents programlisting">
<div class="phpcode"><code><span style="color: #000000">
putenv('TMP=C:/temp');</span>
</code></div>
</div>
</div><p>
The setting must refer to a directory that the web server
has permission to create files in and subsequently write
to and delete the files it created.
Otherwise, you may receive the following error message:
<span class="computeroutput">
malformed database schema -
unable to open a temporary database file for storing temporary tables
</span>
<br />
</p></blockquote>
</div><?php manual_footer(); ?>