php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #30955 PATCH: setting TEMP so SQLite will work on Windows
Submitted: 2004-12-02 02:45 UTC Modified: 2005-02-15 19:29 UTC
From: danielc at analysisandsolutions dot com Assigned:
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS: Windows
Private report: No CVE-ID: None
 [2004-12-02 02:45 UTC] danielc at analysisandsolutions dot com
Description:
------------
If the TEMP environment variable isn't set and the computer in question has some semblance of security, the following error comes up:
    malformed database schema -
    unable to open a temporary database file for storing temporary tables

This is a common problem that has been asked in various forums.

Here is a documentation patch to explain what needs to be done in order to get SQLite to work on secure Windows machines:
http://www.analysisandsolutions.com/php/sqlitetemp.diff

Thanks.


Patches

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-12-02 18:59 UTC] nlopess@php.net
But windows *always* set the TEMP var by default, doesn't it?
I never had such problems on windows...

To which version of windows are you refering to? Windows 9x?
 [2004-12-02 22:47 UTC] danielc at analysisandsolutions dot com
I'm talking about Windows 2000 Pro and XP Pro.

TEMP _might_ be set if the web server is running under the SYSTEM account.  But if the web server service is running under an unprivilged user account TEMP isn't automatically available.

If TEMP isn't set, the sqlite extension goes to write the temporary files into the windows directory.  Not a good idea.
 [2004-12-29 18:02 UTC] mez@php.net
Isn't this more a SQLLite problem than a documentation problem/PHP Problem?
 [2004-12-29 20:25 UTC] nlopess@php.net
I've checked libsqlite code. It is using GetTempPath() on windows to get a temporary file. (http://msdn.microsoft.com/library/en-us/fileio/base/gettemppath.asp)

According to MSDN docs the order is:
1. The path specified by the TMP environment variable.
2. The path specified by the TEMP environment variable.
3. The path specified by the USERPROFILE environment variable.
4. The Windows directory.


So, I think this should be documented.
 [2004-12-29 20:43 UTC] danielc at analysisandsolutions dot com
Nicely put nlopess.  By the way, I've tweaked the patch in the last few minutes.  So, if it gets used, please obtain a fresh copy from the URI, above.
 [2005-02-15 16:24 UTC] danielc at analysisandsolutions dot com
Can someone please apply the patch?
 [2005-02-15 19:29 UTC] nlopess@php.net
Applied.

Thanks for the patch,
Nuno
 [2020-02-07 06:11 UTC] phpdocbot@php.net
Automatic comment on behalf of nlopess
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=5c5aa0d5937e86cc5614bdf2f72a2d27570d5498
Log: fix #30955: TMP windows envar. based on patch by danielc at analysisandsolutions dot com
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Aug 15 18:01:29 2024 UTC