1 <!DOCTYPE HTML
PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2 "http://www.w3.org/TR/html4/loose.dtd">
5 <meta http
-equiv
="Content-type" content
="text/html; charset=utf-8">
6 <meta name
="robots" content
="noindex,nofollow">
7 <title
>MediaWiki installation
</title
>
8 <style type
="text/css">
13 background
-color
: #eee;
15 border
: solid
1px
#444;
34 /* margin-right: 200px; */
47 <a href
="http://www.mediawiki.org/"><img
48 src
="../images/wiki.png" width
="135" height
="135" alt
="" border
="0" /></a
>
51 <b
><a href
="http://www.mediawiki.org/">MediaWiki
</a
></b
> is
52 Copyright (C
) 2001-2004 by Magnus Manske
, Brion Vibber
, Lee Daniel Crocker
,
53 Tim Starling
, Erik M
ö
;ller
, and others
.</p
>
56 <li
><a href
="../README">Readme
</a
></li
>
57 <li
><a href
="../RELEASE-NOTES">Release notes
</a
></li
>
58 <li
><a href
="../docs/">doc
/</a
></li
>
59 <li
><a href
="http://meta.wikipedia.org/wiki/MediaWiki_User's_Guide">User
's Guide</a></li>
62 <p>This program is free software; you can redistribute it and/or modify
63 it under the terms of the GNU General Public License as published by
64 the Free Software Foundation; either version 2 of the License, or
65 (at your option) any later version.</p>
67 <p>This progarm is distributed in the hope that it will be useful,
68 but WITHOUT ANY WARRANTY; without even the implied warranty of
69 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
70 GNU General Public License for more details.</p>
72 <p>You should have received <a href="../COPYING">a copy of the GNU General Public License</a>
73 along with this program; if not, write to the Free Software
74 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
75 or <a href="http://www.gnu.org/copyleft/gpl.html">read it online</a></p>
79 include( "../includes/DefaultSettings.php" );
82 <h1>MediaWiki <?php print $wgVersion ?> installation</h1>
87 /* Check for existing configurations and bug out! */
89 if( file_exists( "../LocalSettings.php" ) || file_exists( "../AdminSettings.php" ) ) {
90 dieout( "<h2>Wiki is configured.</h2>
92 <p>Already configured... <a href='../index
.php
'>return to the wiki</a>.</p>
94 <p>(You should probably remove this directory for added security.)</p>" );
97 if( file_exists( "./LocalSettings.php" ) || file_exists( "./AdminSettings.php" ) ) {
98 dieout( "<h2>You're configured
!</h2
>
100 <p
>Please move
<tt
>LocalSettings
.php
</tt
> to the parent directory
, then
101 <a href
='../index.php'>try out your wiki
</a
>.
102 (You should remove this config directory
for added security once you
're done.)</p>" );
106 include( "../install-utils.inc" );
112 <h2>Checking environment...</h2>
116 $conf = new ConfigData;
118 install_version_checks();
119 print "<li>PHP " . phpversion() . " ok</li>\n";
122 $conf->zlib = function_exists( "gzencode" );
123 $z = $conf->zlib ? "Have" : "No";
124 print "<li>$z zlib support</li>\n";
126 $conf->gd = function_exists( "imagejpeg" );
128 print "<li>Found GD graphics library built-in</li>\n";
130 print "<li>No built-in GD library</li>\n";
133 if( file_exists( "/usr/bin/convert" ) ) {
134 $conf->ImageMagick = "/usr/bin/convert";
135 print "<li>Found ImageMagick: /usr/bin/convert</li>\n";
136 } elseif( file_exists( "/usr/local/bin/convert" ) ) {
137 $conf->ImageMagick = "/usr/local/bin/convert";
138 print "<li>Found ImageMagick: /usr/local/bin/convert</li>\n";
140 $conf->ImageMagick = false;
141 print "<li>No ImageMagick.</li>\n";
145 # $conf->IP = "/Users/brion/Sites/inplace";
147 $conf->IP = getcwd();
149 print "<li>Installation directory: <tt>" . htmlspecialchars( $conf->IP ) . "</tt></li>\n";
151 # $conf->ScriptPath = "/~brion/inplace";
152 $conf->ScriptPath = preg_replace( '{^
(.*)/config
.*$
}', '$1', $_SERVER["REQUEST_URI"] );
153 print "<li>Script URI path: <tt>" . htmlspecialchars( $conf->ScriptPath ) . "</tt></li>\n";
155 $conf->posted = ($_SERVER["REQUEST_METHOD"] == "POST");
157 $conf->Sitename = ucfirst( importPost( "Sitename", "" ) );
158 $conf->EmergencyContact = importPost( "EmergencyContact", $_SERVER["SERVER_ADMIN"] );
159 $conf->DBserver = importPost( "DBserver", "localhost" );
160 $conf->DBname = importPost( "DBname", "wikidb" );
161 $conf->DBuser = importPost( "DBuser", "wikiuser" );
162 $conf->DBpassword = importPost( "DBpassword" );
163 $conf->DBpassword2 = importPost( "DBpassword2" );
164 $conf->RootPW = importPost( "RootPW" );
165 $conf->LanguageCode = importPost( "LanguageCode", "en-utf8" );
167 /* Check for validity */
170 if( $conf->Sitename == "" || $conf->Sitename == "MediaWiki" || $conf->Sitename == "Mediawiki" ) {
171 $errs["Sitename"] = "Must not be blank or \"MediaWiki\".";
173 if( $conf->DBpassword == "" ) {
174 $errs["DBpassword"] = "Must not be blank";
176 if( $conf->DBpassword != $conf->DBpassword2 ) {
177 $errs["DBpassword2"] = "Passwords don't match
!";
180 if( $conf->posted && ( 0 == count( $errs ) ) ) {
181 do { /* So we can 'continue' to end prematurely */
182 $conf->Root = ($conf->RootPW != "");
184 /* Load up the settings and get installin' */
185 $local = writeLocalSettings( $conf );
186 $wgCommandLineMode = false;
189 $wgDBadminuser = $wgDBuser;
190 $wgDBadminpassword = $wgDBpassword;
191 $wgCommandLineMode = true;
192 $wgUseDatabaseMessages = false; /* FIXME: For database failure */
193 include_once( "Setup
.php
" );
196 $wgDatabase = Database::newFromParams( $wgDBserver, "root
", $conf->RootPW, "", 1 );
198 $wgDatabase = Database::newFromParams( $wgDBserver, $wgDBuser, $wgDBpassword, "", 1 );
200 $wgDatabase->mIgnoreErrors = true;
202 if ( !$wgDatabase->isOpen() ) {
203 $errs["DBserver
"] = "Couldn
't connect to database";
207 @$myver = mysql_get_server_info( $wgDatabase->mConn );
209 print "<li>MySQL error " . ($err = mysql_errno() ) .
210 ": " . htmlspecialchars( mysql_error() );
214 $errs["RootPW"] = "Check password";
216 $errs["DBuser"] = "Check name/pass";
217 $errs["DBpassword"] = "or enter root";
218 $errs["DBpassword2"] = "password below";
219 $errs["RootPW"] = "Got root?";
224 $errs["DBserver"] = "Connection failed";
227 $errs["DBserver"] = "Couldn't connect to database
";
231 print "<li
>Connected to database
... $myver";
232 if( version_compare( $myver, "4.0.0" ) >= 0 ) {
233 print "; enabling MySQL
4 enhancements
";
234 $conf->DBmysql4 = true;
235 $local = writeLocalSettings( $conf );
239 @$sel = mysql_select_db( $wgDBname, $wgDatabase->mConn );
241 print "<li
>Database
<tt
>" . htmlspecialchars( $wgDBname ) . "</tt
> exists
</li
>\n";
243 $res = $wgDatabase->query( "CREATE DATABASE `
$wgDBname`
" );
245 print "<li
>Couldn
't create database <tt>" .
246 htmlspecialchars( $wgDBname ) .
247 "</tt>; try with root access or check your username/pass.</li>\n";
248 $errs["RootPW"] = "<- Enter";
251 print "<li>Created database <tt>" . htmlspecialchars( $wgDBname ) . "</tt></li>\n";
254 $wgDatabase->selectDB( $wgDBname );
256 if( $wgDatabase->tableExists( "cur" ) ) {
257 print "<li>There are already MediaWiki tables in this database. Skipping rest of database setup...</li>\n";
259 # FIXME: Check for errors
260 print "<li>Creating tables...";
261 dbsource( "../maintenance/tables.sql", $wgDatabase );
262 dbsource( "../maintenance/interwiki.sql", $wgDatabase );
263 dbsource( "../maintenance/indexes.sql", $wgDatabase );
264 print " done.</li>\n";
266 print "<li>Initializing data...";
267 $wgDatabase->query( "INSERT INTO site_stats (ss_row_id,ss_total_views," .
268 "ss_total_edits,ss_good_articles) VALUES (1,0,0,0)" );
270 # FIXME: Initial sysop account
271 # FIXME: Main page, logs
272 # FIXME: Initialize messages
273 print "<li>(NYI: accounts, pages, messages)</li>\n";
276 # Grant user permissions
277 dbsource( "../maintenance/users.sql", $wgDatabase );
281 /* Write out the config file now that all is well */
282 print "<p>Creating LocalSettings.php...</p>\n\n";
283 $f = fopen( "LocalSettings.php", "xt" );
285 dieout( "Couldn't write out LocalSettings
.php
. Check that the directory permissions are correct
and that there isn
't already a fiel of that name here." );
287 fwrite( $f, "<" . "?php\n$local\n?" . ">" );
290 print "<p>Success! Move the LocalSettings.php file into the parent directory, then follow
291 <a href='{$conf->ScriptPath
}/index
.php
'>this link</a> to your wiki.</p>\n";
301 if( count( $errs ) ) {
302 /* Display options form */
304 if( $conf->posted ) {
305 echo "<p class='error
'>Something's not quite right yet
; make sure everything below is filled out correctly
.</p
>\n";
308 <h2>Database config</h2>
310 <form name="config
" method="post
">
314 aField( $conf, "DBserver
", "MySQL server
" );
317 If your database server isn't on your web server, enter the name
322 aField( $conf, "DBname
", "Database name
" );
325 aField( $conf, "DBuser
", "DB username
" );
328 aField( $conf, "DBpassword
", "DB password
", "password
" );
331 aField( $conf, "DBpassword2
", "again
", "password
" );
334 If you only have a single user account and database available,
335 enter those here. If you have database root access (see below)
336 you can specify new accounts/databases to be created.
342 aField( $conf, "RootPW
", "DB root password
", "password
" );
346 You will only need this if the database and/or user account
347 above don't already exist.
348 Do <em>not</em> type in your machine's root password! MySQL
349 has its own "root
" user with a separate password. (It might
350 even be blank, depending on your configuration.)
359 aField( $conf, "Sitename
", "Site name
:" );
363 Your site name should be a relatively short word. It'll appear as the namespace
364 name for 'meta' pages as well as throughout the user interface. Good site names
365 are things like "<a href
="http://www.wikipedia.org/">Wikipedia
</a
>" and
366 "<a href
="http://openfacts.berlios.de/">OpenFacts
</a
>"; avoid punctuation,
367 which may cause problems.
372 aField( $conf, "EmergencyContact
", "Contact e
-mail
" );
376 If the wiki breaks terribly, it may display this contact address.
380 <label for="LanguageCode
">Language</label>
381 <select id="LanguageCode
" name="LanguageCode
">
383 $list = getLanguageList();
384 foreach( $list as $code => $name ) {
385 $sel = ($code == $conf->LanguageCode) ? "selected
" : "";
386 echo "\t\t
<option value
=\"$code\" $sel>$name</option
>\n";
392 You may select the language for the user interface of the wiki...
393 Some localizations are less complete than others. This also controls
394 the character encoding; Unicode is more flexible, but Latin-1 may be
395 more compatible with older browsers for some languages. The default
396 for most languages is Unicode.
400 <label> </label>
401 <input type="submit
" value="Install
!" />
410 /* -------------------------------------------------------------------------------------- */
412 function writeAdminSettings( $conf ) {
414 \
$wgDBadminuser = \"{$conf->DBadminuser
}\";
415 \
$wgDBadminpassword = \"{$conf->DBadminpassword
}\";
419 function writeLocalSettings( $conf ) {
420 $conf->DBmysql4 = $conf->DBmysql4 ? 'true' : 'false';
421 $conf->UseImageResize = $conf->UseImageResize ? 'true' : 'false';
422 $conf->DBsqluser = $conf->DBuser;
423 $conf->DBsqlpassword = $conf->DBpassword;
424 $conf->PasswordSender = $conf->EmergencyContact;
425 if( $conf->LanguageCode == "en
-utf8
" ) {
426 $conf->LanguageCode = "en
";
427 $conf->Encoding = "UTF
-8";
430 # This file was automatically generated. Don't touch unless you
431 # know what you're doing; see LocalSettings.sample for an edit-
434 \
$IP = \"{$conf->IP
}\";
435 ini_set( \"include_path\"
, \"\
$IP/includes
:\
$IP/languages
:\" . ini_get(\"include_path\"
) );
436 include_once( \"DefaultSettings
.php\"
);
438 if( \
$wgCommandLineMode ) {
439 die( \"Can
't use command-line utils with in-place install yet, sorry.\" );
442 \$wgSitename = \"{$conf->Sitename}\";
444 \$wgScriptPath = \"{$conf->ScriptPath}\";
445 \$wgScript = \"\$wgScriptPath/index.php\";
446 \$wgRedirectScript = \"\$wgScriptPath/redirect.php\";
448 \$wgArticlePath = \"\$wgScript?title=\$1\";
449 # \$wgArticlePath = \"\$wgScript/\$1\"; # Prettier if you're setup
for it
451 \
$wgStyleSheetPath = \"\
$wgScriptPath/stylesheets\"
;
452 \
$wgStyleSheetDirectory = \"\
$IP/stylesheets\"
;
454 \
$wgUploadPath = \"\
$wgScriptPath/images\"
;
455 \
$wgUploadDirectory = \"\
$IP/images\"
;
456 \
$wgLogo = \"\
$wgUploadPath/wiki
.png\"
;
458 \
$wgEmergencyContact = \"{$conf->EmergencyContact
}\";
459 \
$wgPasswordSender = \"{$conf->PasswordSender
}\";
461 \
$wgDBserver = \"{$conf->DBserver
}\";
462 \
$wgDBname = \"{$conf->DBname
}\";
463 \
$wgDBuser = \"{$conf->DBuser
}\";
464 \
$wgDBpassword = \"{$conf->DBpassword
}\";
465 \
$wgDBsqluser = \"{$conf->DBsqluser
}\";
466 \
$wgDBsqlpassword = \"{$conf->DBsqlpassword
}\";
468 \
$wgDBmysql4 = \
$wgEnablePersistentLC = {$conf->DBmysql4
};
470 \
$wgUseImageResize = {$conf->UseImageResize
};
472 ## If you have the appropriate support software installed
473 ## you can enable inline LaTeX equations:
475 # \$wgMathPath = \"{$wgUploadPath}/math\";
476 # \$wgMathDirectory = \"{$wgUploadDirectory}/math\";
477 # \$wgTmpDirectory = \"{$wgUploadDirectory}/tmp\";
479 \
$wgLocalInterwiki = \
$wgSitename;
481 \
$wgLanguageCode = \"{$conf->LanguageCode
}\";
482 " . ($conf->Encoding ? "\
$wgInputEncoding = \
$wgOutputEncoding = \"{$conf->Encoding
}\";" : "" ) . "
487 function dieout( $text ) {
488 die( $text . "\n\n
</body
>\n</html
>" );
491 function importPost( $name, $default = "" ) {
492 if( isset( $_POST[$name] ) ) {
493 return $_POST[$name];
499 function aField( &$conf, $field, $text, $type = "" ) {
500 if( $type != "" ) $type = "type
=\"$type\"";
501 echo "\t\t
<label
for=\"$field\">$text</label
>\n";
502 echo "\t\t
<input
$type name
=\"$field\" id
=\"$field\" value
=\"";
503 echo htmlspecialchars( $conf->$field );
507 if(isset($errs[$field])) echo "<span
class='error'>" . $errs[$field] . "</span
>\n";
510 function getLanguageList() {
511 global $wgLanguageNames;
512 if( !isset( $wgLanguageNames ) ) {
513 $wgLanguageCode = "xxx
";
514 function wfLocalUrl( $x ) { return $x; }
515 function wfLocalUrlE( $x ) { return $x; }
516 include( "../languages
/Language
.php
" );
520 $latin1 = array( "da
", "de
", "en
", "es
", "fr
", "nl
", "sv
" );
522 $d = opendir( "../languages
" );
523 while( false !== ($f = readdir( $d ) ) ) {
524 if( preg_match( '/Language([A-Z][a-z]+)\.php$/', $f, $m ) ) {
525 $code = strtolower( $m[1] );
526 $codes[$code] = "$code - " . $wgLanguageNames[$code];
527 if( in_array( $code, $latin1 ) ) {
528 $codes[$code] .= " - Latin
-1";
532 $codes["en
-utf8
"] = "en
- English
- Unicode
";