<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Installation</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="sqlite.requirements.html">Requirements</a></div> <div class="next" style="text-align: right; float: right;"><a href="sqlite.configuration.html">Runtime Configuration</a></div> <div class="up"><a href="sqlite.setup.html">Installing/Configuring</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="sqlite.installation" class="section"> <h2 class="title">Installation</h2> <p class="para"> Since PHP 5.0 this extension was bundled with PHP. Beginning with PHP 5.4, this extension is available only via PECL. </p> <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.html" 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: <div class="informalexample"> <div class="example-contents"> <div class="inicode"><pre class="inicode">extension=php_pdo.dll extension=php_sqlite.dll</pre> </div> </div> </div> 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.html" class="link">PDO SQLite</a>. </p> <blockquote class="note"><p><strong class="note">Note</strong>: <strong>Windows installation for unprivileged accounts</strong><br /> <p class="para"> On Windows operating systems, unprivileged accounts don't have the <var class="varname"><var class="varname">TMP</var></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"><var class="varname">TMP</var></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: <div class="informalexample"> <div class="example-contents"> <div class="apache-confcode"><pre class="apache-confcode">SetEnv TMP c:/temp</pre> </div> </div> </div> If you are unable to establish this setting at the server level, you can implement the setting in your script: <div class="informalexample"> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br />putenv</span><span style="color: #007700">(</span><span style="color: #DD0000">'TMP=C:/temp'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?></span> </span> </code></div> </div> </div> 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> </p> </p></blockquote> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="sqlite.requirements.html">Requirements</a></div> <div class="next" style="text-align: right; float: right;"><a href="sqlite.configuration.html">Runtime Configuration</a></div> <div class="up"><a href="sqlite.setup.html">Installing/Configuring</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>