Saturday, June 27, 2009

Install MediaWiki on Server 2008

MediaWiki successfully installed/running on Windows 2008 with the following:
Windows Server 2008 Standard SP1 (Virtual Machine)
PHP v5.2.9
MySQL v5.1.34
MediaWiki v1.14

Install IIS7 on Windows Server 2008
  • Open Server Manager
  • Add Role - Web Server
  • Click - Add Required Features
  • Next, Next
  • Select CGI option under Application Development
  • Click Install
  • Install update for FastCGI - KB954946


Install PHP v5.2.9-2
  • Create a new directory: C:\PHP
  • Extract the contents of php-5.2.9-2-Win32.zip to C:\PHP
  • Navigate to C:\PHP and change the name of "php.ini-recommended" to "php.ini"
  • Open php.ini and uncomment the following (uncomment by removing the ;)
    1. open_basedir (then add the following = "C:\inetpub\wwwroot"
    2. extension_dir (then change to show as "./ext"
    3. cgi.force_redirect = 0 (change from 1 to 0)
    4. cgi.fix_pathinfo=1
    5. fastcgi.impersonate = 1
    6. extension=php_mysql.dll
    7. extension=php_mysqli.dll
    8. upload_tmp_dir="C:\inetpub\wwwroot\WikiName\upload" Create a new folder in C:\inetpub\wwwroot\WikiNam named "upload"
    9. session.save_path = "C:\php\session" Create a new folder in C:\PHP named "session".
    10. IMPORTANT - Ensure that the session and upload folders created have write permissions for Users.
  • At command prompt navigate to C:\PHP and type enter php -info (ie C:\PHP\php -info) You should see the config of php or a lot of information scroll across the screen
  • Open IIS Manager
  • Open Handler Mappings
  • Select "Add Module Mapping"
    1. Request path = *.php
    2. Module = FastCgiModule
    3. Executable = C:\PHP\php-cgi.exe
    4. Name = PHP via FastCGI
  • Click OK, then Yes when prompted
  • Navigate to C:\inetpub\wwwroot and create a new file named phpinfo.php then edit the contents to show (I can't seem to get blockquote to work for anything so...) Starts with lesser than sign (no space) then ?php phpinfo(); ? followed by greater than sign (no space)
  • Open IE and navigate to http://localhost/phpinfo.php the site should display as PHP Version 5.2.9-2 with other config data on the rest of the page


Install MySQL v5.1.34
  • Run mysql-5.1.34-win32.msi to install
  • Typical install
  • Default Location
  • Configure the MySQL Server now option checked
  • Change to standard configuration
  • Install as Windows Service (Default)
  • Uncheck Modify Security Settings (This will be changed later)
  • Execute (note that it may have errors and fail, if so hit cancel)
  • From a command prompt navigate to C:\Program Files\MySQL\MySQL Server 5.1\bin
  • Type mysqladmin -u root password NEWPASSWORD


Install MediaWiki v1.14
  • Create new directory C:\inetpub\wwwroot\WikiName
  • Copy mediawiki-1.14.0 contents to C:\inetpub\wwwroot\WikiName
  • Run the following at a command prompt to grant permissions to the config folder (so that it can write the localsettings file) icacls %SystemDrive%\Inetpub\wwwroot\MediaWiki\config /grant BUILTIN\IIS_IUSRS:(W)
  • Open IE and navigate to http://localhost/WikiName/config/index.php
  • Enter Wiki name: WikiName
  • Database Config
    1. Database name = WikiName
    2. Username = root
    3. Password = MySQL root password
  • Click "Install MediaWiki!"
  • At the bottom of the next page you should see "Installation Successful!"
  • Close IE
  • Copy the localsettings.php from C:\inetpub\wwwroot\WikiName\config to C:\inetpub\wwwroot\WikiName
  • Open IE and navigate to http://localhost/WikiName/index.php You should see the Main page "MediaWiki has been successfully installed"
  • Delete the config folder
  • Change permissions on the WikiName\Images folder so that Users and IUSR have write access (for uploads to work)


Other Goodies to enable:
Uploads
* $wgEnableUploads = true;
* $wgFileExtenstions = array('png', 'gif', 'jpg', 'jpeg', 'doc', 'xls', 'pdf');
* $wgVerifyMimeType = false;

Disable reading by anonymous users
* $wgGroupPermissions['*']['read'] = false;
But allow them to read e.g., these pages:
* $wgWhitelistRead = array ("Main Page", "Special:Userlogin", "Help:Contents");
* $wgGroupPermissions['*']['edit'] = false;

Custom Logo
* wgLogo = "{$wgScriptPath}/ImageName.jpg"; (image saved in the WikiName root folder)

4 comments:

  1. I recently came accross your blog and have been reading along. I thought I would leave my first comment. I dont know what to say except that I have enjoyed reading. Nice blog. I will keep visiting this blog very often.


    Susan

    http://8080proxy.com

    ReplyDelete
  2. I was having trouble with image uploads unless I gave write permission to "Everyone" so I was looking for a more limited option. I found your post that mentioned "Users" in addition to ISUSR, and that worked. Thanks.

    ReplyDelete
  3. I got:
    "C:\PHP>php -info
    Could not open input file: o"

    after i modified php.ini

    I took php.ini-Development and change it to php.ini

    and then uncomment as you did with the values as you specify

    but i'm getting "Could not open input file: o" i have all the authorization

    ReplyDelete
  4. First off - I no longer use MediaWiki or really mess around with PHP anymore, but couple things come to mind.

    Ensure that the extension on php.ini is correct (ie unhide the file extensions and ensure .txt isn't appended to the end)
    also, you may want to try running it with "run as administrator" if this is Server 2008 R2.
    Note that depending on the version of windows your running that may also be the issue. I did this on Server 2008 with SP2 and 32bit system.
    Sorry I can't be more help.

    ReplyDelete