, 2006 Rob Church
# http://www.mediawiki.org/
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# http://www.gnu.org/copyleft/gpl.html
error_reporting( E_ALL );
header( "Content-type: text/html; charset=utf-8" );
@ini_set( "display_errors", true );
?>
MediaWiki 1.5 Installation
MediaWiki is
Copyright (C) 2001-2006 by Magnus Manske, Brion Vibber, Lee Daniel Crocker,
Tim Starling, Erik Möller, Gabriel Wicke and others.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
or read it online
In order to configure the wiki you have to make the config subdirectory
writable by the web server. Once configuration is done you'll move the created
LocalSettings.php to the parent directory, and for added safety you can
then remove the config subdirectory entirely.
To make the directory writable on a Unix/Linux system:
cd /path/to/wiki
chmod a+w config
" );
}
require_once( "install-utils.inc" );
require_once( "maintenance/updaters.inc" );
class ConfigData {
function getEncoded( $data ) {
# removing latin1 support, no need...
return $data;
}
function getSitename() { return $this->getEncoded( $this->Sitename ); }
function getSysopName() { return $this->getEncoded( $this->SysopName ); }
function getSysopPass() { return $this->getEncoded( $this->SysopPass ); }
}
?>
Please include all of the lines below when reporting installation problems.
Warning:PHP's
register_globals
option is enabled. MediaWiki will work correctly, but this setting
increases your exposure to potential security vulnerabilities in PHP-based
software running on your server. You should disable it if you are able.
Fatal: magic_quotes_runtime is active!
This option corrupts data input unpredictably; you cannot install or use
MediaWiki unless this option is disabled.
Fatal: magic_quotes_sybase is active!
This option corrupts data input unpredictably; you cannot install or use
MediaWiki unless this option is disabled.
Fatal: mbstring.func_overload is active!
This option causes errors and may corrupt data unpredictably;
you cannot install or use MediaWiki unless this option is disabled.
PHP server API is $sapi; ";
switch( $sapi ) {
case "apache":
case "apache2handler":
print "ok, using pretty URLs (index.php/Page_Title)";
break;
default:
print "unknown; ";
case "cgi":
case "cgi-fcgi":
case "apache2filter":
case "isapi":
print "using ugly URLs (index.php?title=Page_Title)";
$conf->prettyURLs = false;
break;
}
print "
\n";
} else {
dieout( "PHP's XML module is missing; the wiki requires functions in
this module and won't work in this configuration.
If you're running Mandrake, install the php-xml package." );
}
$memlimit = ini_get( "memory_limit" );
$conf->raiseMemory = false;
if( empty( $memlimit ) || $memlimit == -1 ) {
print "
PHP is configured with no memory_limit.
\n";
} else {
print "
PHP's memory_limit is " . htmlspecialchars( $memlimit ) . ". If this is too low, installation may fail! ";
$n = IntVal( $memlimit );
if( preg_match( '/^([0-9]+)[Mm]$/', trim( $memlimit ), $m ) ) {
$n = IntVal( $m[1] * (1024*1024) );
}
if( $n < 20*1024*1024 ) {
print "Attempting to raise limit to 20M... ";
if( false === ini_set( "memory_limit", "20M" ) ) {
print "failed.";
} else {
$conf->raiseMemory = true;
print "ok.";
}
}
print "
\n";
}
# Determine how we're going to connect to the database
if( $conf->RootPW == '-' ) {
# Regular user
$conf->Root = false;
$db_user = $wgDBuser;
$db_pass = $wgDBpassword;
} else {
# Superuser
$conf->Root = true;
$db_user = $conf->RootUser;
$db_pass = $conf->RootPW;
}
# Now attempt the connection
echo( "
Connecting to $wgDBname on $wgDBserver as $db_user..." );
$wgDatabase = Database::newFromParams( $wgDBserver, $db_user, $db_pass, "", 1 );
if( $wgDatabase->isOpen() ) {
# We're in; set up a few variables
$ok = true;
echo( "success.
\n" );
$wgDatabase->ignoreErrors( true );
$myver = mysql_get_server_info( $wgDatabase->mConn );
$wgDBadminuser = $db_user;
$wfDBadminpassword = $db_pass;
} else {
# There was an error; if we recognise it, give some useful feedback
$ok = false;
$errno = mysql_errno();
$errtx = htmlspecialchars( mysql_error() );
echo( "failed with error $errno: $errtx.\n" );
switch( $errno ) {
case 1045:
case 2000:
# Authentication
if( $conf->Root ) {
# The superuser details are wrong
$errs["RootUser"] = "Check username";
$errs["RootPW"] = "and password";
} else {
# The regular user details are wrong
$errs["DBuser"] = "Check username";
$errs["DBpassword"] = "and password";
}
break;
default:
# Something else
$errs["DBserver"] = "Couldn't connect to database";
break;
} # switch
} # conn att
if( !$ok ) continue;
# Print out the mySQL version and enable mySQL 4 enhancements as needed
echo( "
Connected to $myver" );
if( version_compare( $myver, "4.0.0" ) >= 0 ) {
echo( "; using enhancements for mySQL 4.
" );
$conf->DBmysql4 = true;
$local = writeLocalSettings( $conf );
}
# Check for possible authentication problems re. password encryption in newer mySQL versions
$mysqlNewAuth = version_compare( $myver, "4.1.0", "ge" );
if( $mysqlNewAuth && $mysqlOldClient ) {
echo( "
\n" );
}
# Check versions with regards to character sets, cough up an error if there are inconsistencies
if( $wgDBmysql5 ) {
if( $mysqlNewAuth ) {
echo( "
Enabling mySQL 4.1/5.0 character set mode.
\n" );
} else {
echo( "
mySQL 4.1/5.0 character set mode has been enabled, however, an older version of mySQL has been detected. This will likely cause the installation to fail.
Creating tables...";
if( $wgDBmysql5 ) {
print " using MySQL 5 table defs...";
dbsource( "../maintenance/mysql5/tables.sql", $wgDatabase );
} else {
print " using MySQL 3/4 table defs...";
dbsource( "../maintenance/tables.sql", $wgDatabase );
}
dbsource( "../maintenance/interwiki.sql", $wgDatabase );
print " done.
\n";
print "
Initializing data...";
$wgDatabase->insert( 'site_stats',
array( 'ss_row_id' => 1,
'ss_total_views' => 0,
'ss_total_edits' => 0,
'ss_good_articles' => 0 ) );
# Set up the DB user if we (i) can and (ii) need to
if( $conf->Root ) {
$db = Database::newFromParams( $wgDBserver, $wgDBuser, $wgDBpassword, $wgDBname, 1 );
if( $db->isOpen() ) {
$db->close();
} else {
print "
If you are in a shared hosting environment, do not just move LocalSettings.php
remotely. LocalSettings.php is currently owned by the user your webserver is running under,
which means that anyone on the same server can read your database password! Downloading
it and uploading it again will hopefully change the ownership to a user ID specific to you.
EOT;
} else {
echo "
Installation successful! Move the config/LocalSettings.php file into the parent directory, then follow
this link to your wiki.