Page MenuHomePhabricator

lighttpd + sqlite installation failure
Closed, ResolvedPublic


Author: vavarachen

Fix applied to line 25


When attempting to install mediawiki using sqlite as the backend, I get the following errors.

Warning: mkdir() [function.mkdir]: Permission denied in /repos/mediawiki/includes/db/DatabaseSqlite.php on line 26

Attempting to connect to database "wikidb" as "wikiuser"...

Warning: mkdir() [function.mkdir]: Permission denied in /repos/mediawiki/includes/db/DatabaseSqlite.php on line 26

Fatal error: Call to undefined function wfPrintError() in /repos/mediawiki/includes/Exception.php on line 283

Upon closer inspection, I noticed that line 25 contains the following:
if ("$wgSQLiteDataDir" == '') $wgSQLiteDataDir = dirname($_SERVER['DOCUMENT_ROOT']).'/data';

dirname function call does not make sense here because $_SERVER['DOCUMENT_ROOT' is always a directory. In my case it is "_ENV["DOCUMENT_ROOT"] /repos" (from phpinfo() ).

dirname function returns / and attempts to create the directory at //data.

Simple fix:
if ("$wgSQLiteDataDir" == '') $wgSQLiteDataDir = $_SERVER['DOCUMENT_ROOT'].'/data';


Version: 1.13.x
Severity: normal
OS: Linux




Related Objects

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:35 PM
bzimport set Reference to bz17611.
bzimport added a subscriber: Unknown Object (MLST).

I'm not sure how that would help. It still wouldn't be a directory, right? So you'd still get the same error.

If the autodetected data directory is wrong, you should enter one manually in the "SQLite data directory" box. I've committed a change in r50329 for release in 1.15 which hopefully makes this more clear.

Note that you should *not* use a directory which is in the document root, because if you do that, the whole database will be publically accessible, leaking private information such as user password hashes. The dirname() is there to put the data directory one level up from the document root, e.g. in /var/data when /var/www is the document root.