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;
45 <a href
="http://www.mediawiki.org/"><img
46 src
="../images/wiki.png" width
="135" height
="135" alt
="" border
="0" /></a
>
49 <b
><a href
="http://www.mediawiki.org/">MediaWiki
</a
></b
> is
50 Copyright (C
) 2001-2004 by Magnus Manske
, Brion Vibber
, Lee Daniel Crocker
,
51 Tim Starling
, Erik M
ö
;ller
, and others
.</p
>
54 <li
><a href
="../README">Readme
</a
></li
>
55 <li
><a href
="../RELEASE-NOTES">Release notes
</a
></li
>
56 <li
><a href
="../docs/">doc
/</a
></li
>
57 <li
><a href
="http://meta.wikipedia.org/wiki/MediaWiki_User's_Guide">User
's Guide</a></li>
60 <p>This program is free software; you can redistribute it and/or modify
61 it under the terms of the GNU General Public License as published by
62 the Free Software Foundation; either version 2 of the License, or
63 (at your option) any later version.</p>
65 <p>This progarm is distributed in the hope that it will be useful,
66 but WITHOUT ANY WARRANTY; without even the implied warranty of
67 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
68 GNU General Public License for more details.</p>
70 <p>You should have received <a href="../COPYING">a copy of the GNU General Public License</a>
71 along with this program; if not, write to the Free Software
72 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
73 or <a href="http://www.gnu.org/copyleft/gpl.html">read it online</a></p>
77 include( "../includes/DefaultSettings.php" );
80 <h1>MediaWiki <?php print $wgVersion ?> installation</h1>
85 /* Check for existing configurations and bug out! */
87 if( file_exists( "../LocalSettings.php" ) || file_exists( "../AdminSettings.php" ) ) {
88 dieout( "<h2>Wiki is configured.</h2>
90 <p>Already configured... <a href='../index
.php
'>return to the wiki</a>.</p>
92 <p>(You should probably remove this directory for added security.)</p>" );
95 if( file_exists( "./LocalSettings.php" ) || file_exists( "./AdminSettings.php" ) ) {
96 dieout( "<h2>You're configured
!</h2
>
98 <p
>Please move
<tt
>LocalSettings
.php
</tt
> to the parent directory
, then
99 <a href
='../index.php'>try out your wiki
</a
>.
100 (You should remove this config directory
for added security once you
're done.)</p>" );
104 include( "../install-utils.inc" );
110 <h2>Checking environment...</h2>
114 $conf = new ConfigData;
116 install_version_checks();
117 print "<li>PHP " . phpversion() . " ok</li>\n";
120 $conf->zlib = function_exists( "gzencode" );
121 $z = $conf->zlib ? "Have" : "No";
122 print "<li>$z zlib support</li>\n";
124 $conf->gd = function_exists( "imagejpeg" );
126 print "<li>Found GD graphics library built-in</li>\n";
128 print "<li>No built-in GD library</li>\n";
131 if( file_exists( "/usr/bin/convert" ) ) {
132 $conf->ImageMagick = "/usr/bin/convert";
133 print "<li>Found ImageMagick: /usr/bin/convert</li>\n";
134 } elseif( file_exists( "/usr/local/bin/convert" ) ) {
135 $conf->ImageMagick = "/usr/local/bin/convert";
136 print "<li>Found ImageMagick: /usr/local/bin/convert</li>\n";
138 $conf->ImageMagick = false;
139 print "<li>No ImageMagick.</li>\n";
143 # $conf->IP = "/Users/brion/Sites/inplace";
145 $conf->IP = getcwd();
147 print "<li>Installation directory: <tt>" . htmlspecialchars( $conf->IP ) . "</tt></li>\n";
149 # $conf->ScriptPath = "/~brion/inplace";
150 $conf->ScriptPath = preg_replace( '{^
(.*)/config
.*$
}', '$1', $_SERVER["REQUEST_URI"] );
151 print "<li>Script URI path: <tt>" . htmlspecialchars( $conf->ScriptPath ) . "</tt></li>\n";
158 $conf->Sitename = ucfirst( importPost( "Sitename", "" ) );
159 $conf->EmergencyContact = importPost( "EmergencyContact", $_SERVER["SERVER_ADMIN"] );
160 $conf->DBserver = importPost( "DBserver", "localhost" );
161 $conf->DBname = importPost( "DBname", "wikidb" );
162 $conf->DBuser = importPost( "DBuser", "wikiuser" );
163 $conf->DBpassword = importPost( "DBpassword" );
164 $conf->DBpassword2 = importPost( "DBpassword2" );
165 $conf->RootPW = importPost( "RootPW" );
166 $conf->LanguageCode = importPost( "LanguageCode", "en-utf8" );
168 /* Check for validity */
171 if( $conf->Sitename == "" || $conf->Sitename == "MediaWiki" || $conf->Sitename == "Mediawiki" ) {
172 $errs["Sitename"] = "Must not be blank or \"MediaWiki\".";
174 if( $conf->DBpassword == "" ) {
175 $errs["DBpassword"] = "Must not be blank";
177 if( $conf->DBpassword != $conf->DBpassword2 ) {
178 $errs["DBpassword2"] = "Passwords don't match
!";
181 if( count( $errs ) ) {
182 /* Display options form */
184 <h2>Database config</h2>
186 <form name="config
" method="post
">
190 aField( $conf, "DBserver
", "MySQL server
" );
193 If your database server isn't on your web server, enter the name
198 aField( $conf, "DBname
", "Database name
" );
201 aField( $conf, "DBuser
", "DB username
" );
204 aField( $conf, "DBpassword
", "DB password
", "password
" );
207 aField( $conf, "DBpassword2
", "again
", "password
" );
210 If you only have a single user account and database available,
211 enter those here. If you have database root access (see below)
212 you can specify new accounts/databases to be created.
218 aField( $conf, "RootPW
", "DB root password
", "password
" );
222 You will only need this if the database and/or user account
223 above don't already exist.
224 Do <em>not</em> type in your machine's root password! MySQL
225 has its own "root
" user with a separate password. (It might
226 even be blank, depending on your configuration.)
235 aField( $conf, "Sitename
", "Site name
:" );
239 Your site name should be a relatively short word. It'll appear as the namespace
240 name for 'meta' pages as well as throughout the user interface. Good site names
241 are things like "<a href
="http://www.wikipedia.org/">Wikipedia
</a
>" and
242 "<a href
="http://openfacts.berlios.de/">OpenFacts
</a
>"; avoid punctuation,
243 which may cause problems.
248 aField( $conf, "EmergencyContact
", "Contact e
-mail
" );
252 If the wiki breaks terribly, it may display this contact address.
256 <label for="LanguageCode
">Language</label>
257 <select id="LanguageCode
" name="LanguageCode
">
259 $list = getLanguageList();
260 foreach( $list as $code => $name ) {
261 $sel = ($code == $conf->LanguageCode) ? "selected
" : "";
262 echo "\t\t
<option value
=\"$code\" $sel>$name</option
>\n";
268 You may select the language for the user interface of the wiki...
269 Some localizations are less complete than others. This also controls
270 the character encoding; Unicode is more flexible, but Latin-1 may be
271 more compatible with older browsers for some languages. The default
272 for most languages is Unicode.
276 <label> </label>
277 <input type="submit
" value="Install
!" />
286 print "<p
>Creating LocalSettings
.php
...</p
>\n\n";
288 $local = writeLocalSettings( $conf );
289 $f = fopen( "LocalSettings
.php
", "xt
" );
291 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
." );
293 fwrite( $f, $local );
296 print "<p
>Success
! Move the LocalSettings
.php file into the parent directory
, then follow
297 <a href
='{$conf->ScriptPath}/index.php'>this link
</a
> to your wiki
.</p
>\n";
300 /* -------------------------------------------------------------------------------------- */
302 function writeAdminSettings( $conf ) {
304 \
$wgDBadminuser = \"{$conf->DBadminuser
}\";
305 \
$wgDBadminpassword = \"{$conf->DBadminpassword
}\";
309 function writeLocalSettings( $conf ) {
310 $conf->DBmysql4 = $conf->DBmysql4 ? 'true' : 'false';
311 $conf->UseImageResize = $conf->UseImageResize ? 'true' : 'false';
312 $conf->DBsqluser = $conf->DBuser;
313 $conf->DBsqlpassword = $conf->DBpassword;
314 $conf->PasswordSender = $conf->EmergencyContact;
315 if( $conf->LanguageCode == "en
-utf8
" ) {
316 $conf->LanguageCode = "en
";
317 $conf->Encoding = "UTF
-8";
320 # This file was automatically generated. Don't touch unless you
321 # know what you're doing; see LocalSettings.sample for an edit-
324 \
$IP = \"{$conf->IP
}\";
325 ini_set( \"include_path\"
, ini_get(\"include_path\"
) . \":\
$IP/includes
:\
$IP/languages\"
);
326 include_once( \"includes
/DefaultSettings
.php\"
);
328 if( \
$wgCommandLineMode ) {
329 die( \"Can
't use command-line utils with in-place install yet, sorry.\" );
332 \$wgSitename = \"{$conf->Sitename}\";
334 \$wgScriptPath = \"{$conf->ScriptPath}\";
335 \$wgScript = \"\$wgScriptPath/index.php\";
336 \$wgRedirectScript = \"\$wgScriptPath/redirect.php\";
338 \$wgArticlePath = \"\$wgScript?title=\$1\";
339 # \$wgArticlePath = \"\$wgScript/\$1\"; # Prettier if you're setup
for it
341 \
$wgStyleSheetPath = \"\
$wgScriptPath/stylesheets\"
;
342 \
$wgStyleSheetDirectory = \"\
$IP/stylesheets\"
;
344 \
$wgUploadPath = \"\
$wgScriptPath/images\"
;
345 \
$wgUploadDirectory = \"\
$IP/images\"
;
346 \
$wgLogo = \"\
$wgUploadPath/wiki
.png\"
;
348 \
$wgEmergencyContact = \"{$conf->EmergencyContact
}\";
349 \
$wgPasswordSender = \"{$conf->PasswordSender
}\";
351 \
$wgDBserver = \"{$conf->DBserver
}\";
352 \
$wgDBname = \"{$conf->DBname
}\";
353 \
$wgDBuser = \"{$conf->DBuser
}\";
354 \
$wgDBpassword = \"{$conf->DBpassword
}\";
355 \
$wgDBsqluser = \"{$conf->DBsqluser
}\";
356 \
$wgDBsqlpassword = \"{$conf->DBsqlpassword
}\";
358 \
$wgDBmysql4 = \
$wgEnablePersistentLC = {$conf->DBmysql4
};
360 \
$wgUseImageResize = {$conf->UseImageResize
};
362 ## If you have the appropriate support software installed
363 ## you can enable inline LaTeX equations:
365 # \$wgMathPath = \"{$wgUploadPath}/math\";
366 # \$wgMathDirectory = \"{$wgUploadDirectory}/math\";
367 # \$wgTmpDirectory = \"{$wgUploadDirectory}/tmp\";
369 \
$wgLocalInterwiki = \
$wgSitename;
371 \
$wgLanguageCode = \"{$conf->LanguageCode
}\";
372 " . ($conf->Encoding ? "\
$wgInputEncoding = \
$wgOutputEncoding = \"{$conf->Encoding
}\";" : "" ) . "
377 function dieout( $text ) {
378 die( $text . "\n\n
</body
>\n</html
>" );
381 function importPost( $name, $default = "" ) {
382 if( isset( $_POST[$name] ) ) {
383 return $_POST[$name];
389 function aField( &$conf, $field, $text, $type = "" ) {
390 if( $type != "" ) $type = "type
=\"$type\"";
391 echo "\t\t
<label
for=\"$field\">$text</label
>\n";
392 echo "\t\t
<input
$type name
=\"$field\" id
=\"$field\" value
=\"";
393 echo htmlspecialchars( $conf->$field );
397 if(isset($errs[$field])) echo "<span
class='error'>" . $errs[$field] . "</span
>\n";
400 function getLanguageList() {
401 $wgLanguageCode = "xxx
";
402 function wfLocalUrl( $x ) { return $x; }
403 function wfLocalUrlE( $x ) { return $x; }
404 include( "../languages
/Language
.php
" );
407 $latin1 = array( "da
", "de
", "en
", "es
", "fr
", "nl
", "sv
" );
409 $d = opendir( "../languages
" );
410 while( false !== ($f = readdir( $d ) ) ) {
411 if( preg_match( '/Language([A-Z][a-z]+)\.php$/', $f, $m ) ) {
412 $code = strtolower( $m[1] );
413 $codes[$code] = "$code - " . $wgLanguageNames[$code];
414 if( in_array( $code, $latin1 ) ) {
415 $codes[$code] .= " - Latin
-1";
419 $codes["en
-utf8
"] = "en
- English
- Unicode
";