Page MenuHomePhabricator

lighttpd + sqlite installation failure
Closed, ResolvedPublic

Description

Author: vavarachen

Description:
Fix applied to line 25

sqlite-3.3.6-2
php-5.1.6-20.el5_2.1
lighttpd-1.4.20-1.el5.rf
mediawiki-1.13.4

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';

Cheers,
Vijay


Version: 1.13.x
Severity: normal
OS: Linux

Attached:

Details

Reference
bz17611

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.