<?xml version="1.0" encoding="iso-8859-1"?>
<chapter id="setup_windows">
  <title>Setting up moregroupware on Windows</title>
  
  <section id="setup_windows_intro">
    <title>Introduction</title>
    
    <para>To get a stable installation I will recommend running
      Moregroupware at Linux. But it is also possible to install
      Moregroupware to run at the Windows platform. I have managed to get
      Moregroupware to work both under Windows NT, Windows 2000, Windows XP
      and even Windows 9x (not so very stable).
    </para>
    
    <para>
      Remember to make a <filename>tmp</filename> folder on the system
      partition (C:). If not you can get many strange PHP errors as the
      default <filename>php.ini</filename> file is set to use that temporary
      folder to e. g. session files.
    </para>
    
    <para>You can of course also edit php.ini to use another temp folder
      (session.save_path = /tmp) if you want.
    </para>
  </section>
  
  <section id="setup_windows_download">
    <title>Download</title>
    
    <para>In order to run Moregroupware at your "server" you must have
      installed:
    </para>
    
    <itemizedlist>
      <listitem>
        <para>Apache web - server</para>
      </listitem>
      <listitem>
        <para>PHP4 server-side scripting system</para>
      </listitem>
      <listitem>
        <para>MySQL database</para>
      </listitem>
      <listitem>
        <para>And of course the moregroupware package.</para>
      </listitem>
    </itemizedlist>
    
    <para>The first ting you should do is to download the packets
      mentioned above to a temporary catalogue at your computer:
    </para>
    
    <itemizedlist>
      <listitem>
        <para>Apache: Download Apache (e. g. apache_1.3.27-win32-x86-no_src.exe) from <ulink url="http://www.apache.org/dist/httpd/binaries/win32/">http://www.apache.org/dist/httpd/binaries/win32/</ulink>
      </para>
    </listitem>
    <listitem>
      <para>PHP4: Download PHP-4.2.x-Win32.zip package from <ulink url="http://www.php.net/downloads.php">http://www.php.net/downloads.php</ulink>
    </para>
  </listitem>
  <listitem>
    <para>MySQL: Download mysql-3.23.xx-win.zip (stable) from <ulink url="http://www.mysql.com/downloads/">http://www.mysql.com/downloads/</ulink>
  </para>
</listitem>
<listitem>
  <para>more.groupware: You can visit <ulink url="http://www.moregroupware.org/download.php">http://www.moregroupware.org/download.php</ulink> to download the latest stable version of more.groupware
</para>
</listitem>
</itemizedlist>

<para>To get the newest version you should use WinCVS. You will find
instructions about using WinCVS at the bottom of the page at
<ulink url="http://www.moregroupware.org/download.php">http://www.moregroupware.org/download.php
</ulink>
.
</para>

<para>If you think it is complicated to configure WinCVS you can in
stead download with your browser the latest stable-tree snapshot from
<ulink url="http://www.moregroupware.org/snapshots.php">http://www.moregroupware.org/snapshots.php
</ulink>
.
</para>

<para>Ok. Now you have downloaded the files you need to install
Moregroupware.  Now we shall begin to install the downloaded
stuff.
</para>

</section>

<section id="setup_windows_apache">
<title>Installing Apache</title>

<note>
<para>At the moment I will not recommend to use Apache/2.0.x. I got
many strange problems when I ran MGW, PHP and Apache/2.0.x. E. g. the
browser often told me that the page could not be displayed and I got
problems in the webmail2 module to show pictures included in incoming
e-mails.
</para>

<para>The PHP support for Apache/2.0.x is quite buggy at the moment,
so it can be a good idea to continue to use Apache 1.3.x and wait with
the upgrade for a while.
</para>

<para>MGW should be compatible with PHP/4.1.x or later. The support
for PHP/4.0.x or earlier has newly been dropped because of security
and coding problems.
</para>
</note>

<para>First we begin with installing Apache. Installing Apache is
quite easy as the installation program uses the known Installation
Wizard system.
</para>

<para>Run the Apache installation - file, press Next, Agree with the
License Agreement, Next and Next. Now we have come to some important
choices regarding Server Information:
</para>

<itemizedlist>
<listitem>
<para>Network Domain: Just write something of your own
choice here if you only shall use Moregroupware at the inside of you
local network (e. g.  mydomain.net).
</para>
</listitem>
<listitem>
<para>Server name: Write your Windows PC name here. It
should be the name that the other computers in the network use if they
want to communicate with your PC (e. g. PC1). If you are unsure of the
name you could write localhost.
</para>
</listitem>
<listitem>
<para>Administrator's Email Address: Your
e-mail.
</para>
</listitem>
</itemizedlist>

<para>Press Next, choose Complete installation together with Next and
accept standard installation path. Press Next and Install. (If you
must do some configuration changes afterwards you will have to edit
httpd.conf. To do that you can choose Start + Programs + Apache HTTP
Server + Configure Apache
</para>

<para>After the installation you will find a new program group called
Apache HTTP server with possibilities to edit configuration and to
start / stop / restart Apache (Start + Programs + Apache HTTP server +
Your choice).
</para>

<para>Start your favourite internet browser. Write in the address
http://localhost/ or http://yourPCname/ (yourPCname is the named you
wrote in the Server Name field when you installed Apache). You should
now get a test page which tells you what Apache is running.
</para>

<para>We shall do some configuration changes in Apache later, but now
it is time to install PHP
</para>

</section>

<section id="setup_windows_php">
<title>Installing PHP</title>

<itemizedlist>
<listitem>
<para>Unzip the php zip - file to C:\php (To unzip the files
you will need <ulink
url="http://www.powerarchiver.com/">Powerarchiver
</ulink>
or <ulink
url="http://www.winzip.com/">Winzip
</ulink>
or a similar
tool).
</para>
</listitem>
<listitem>
<para>Use Windows Explorer to get into the folder
<filename>C:\php</filename>
</para>
</listitem>
<listitem>
<para>Rename php.ini-dist to php.ini and open the file in a
text editor (e. g.  Notepad).
</para>
</listitem>
<listitem>
<para>
Create the folder <filename>C:\web</filename> where we
shall store the HTML/PHP files.
</para>
</listitem>
<listitem>
<para>You must do two changes in the file:
<literal>doc_root</literal> shall be changed to <literal>doc_root =
"c:\web"
</literal>
and <literal>extension_dir</literal> shall be
changed to <literal>extension_dir =
"c:\php\extensions"
</literal>
</para>
</listitem>
<listitem>
<para>Save the file.</para>
</listitem>
</itemizedlist>

<para>Usually not necessary: If you get problems with the
Apache/PHP-integration you can try to move (or copy) both
<filename>php.ini</filename> and <filename>php4ts.dll</filename> to
your windows path (e. g.  <filename>C:\winnt</filename> or
<filename>C:\windows</filename>).
</para>

<para>Some times you also have to change the Windows include path in
<filename>php.ini</filename> from <literal>;include_path =
".;c:\php\includes"
</literal>
to <literal>include_path = "."</literal>
(remove ; and at least use a dot (.) as include_path.)
</para>

<para>The default setting for register_globals is off. It is a
security risk to set it to on, but at the moment you must do it to get
all the functions in MGW to work: <literal>register_globals = On</literal>
</para>

<para>You must also do some configuration changes in the Apache
configuration file to get PHP to work. Open
<filename>C:\web\Apache\conf\httpd.conf</filename> in your text editor
(e. g. Notepad) and do the following changes:
<programlisting><![CDATA[
DocumentRoot "C:/web"

<Directory "C:/web">]]>
      </programlisting>
    Use / (forward slash) and NOT \ (backslash)!!!!</para>
    
    <para>Find the line <literal>AddType application/x-tar .tgz</literal>
      and add the following lines below:
      <programlisting>
        ScriptAlias /php4/ "c:/php/"
        AddType application/x-httpd-php .php
        AddType application/x-httpd-php .php3
        AddType application/x-httpd-php .php4
        Action application/x-httpd-php "/php4/php.exe"
      </programlisting>
    </para>
    
    <para>To avoid file listing in stead of running
      <filename>index.php</filename> files you can add
      <filename>index.php</filename> to the
      <literal>DirectoryIndex</literal> parameter:
      <programlisting>
        DirectoryIndex index.html index.php
      </programlisting>
    </para>
    
    <para>Save your file. You now have to restart the Apache web server to
    activate the changes.</para>
    
    <para>After restarting the Apache server you can make a test file to check that
      the PHP extensions work. Start your text editor, write
      <programlisting><![CDATA[<?php phpinfo(); ?>]]>
</programlisting>
and save the file in <filename>C:\web</filename> as
<filename>test.php</filename>
</para>

<para>Start your webbrowser with the web page
<literal>http://localhost/test.php</literal> or
<literal>http://yourPCname/test.php</literal>. You should get a lot of
information about PHP.
</para>

<section id="setup_windows_php_module">
<title>Setting up PHP as Apache module</title>

<para>Above we have set PHP Server API to CGI. To get better speed
etc. it can be a smart move to change from CGI to Apache. To do that
you must open httpd.conf and replace the lines below:
<programlisting>
ScriptAlias /php4/ "c:/php/"
AddType application/x-httpd-php .php
AddType application/x-httpd-php .php3
AddType application/x-httpd-php .php4
Action application/x-httpd-php "/php4/php.exe"
</programlisting>
with:
<programlisting>
LoadModule php4_module c:/php/sapi/php4apache.dll
AddModule mod_php4.c
AddType application/x-httpd-php .php
</programlisting>
</para>

<para>
You must MOVE <filename>php4ts.dll</filename> from
<filename>C:\php</filename> to
<filename>C:\windows\system32</filename> (or
<filename>C:\winnt\system32</filename>). <filename>php.ini</filename>
should be moved to <filename>C:\windows</filename> (or
<filename>C:\winnt</filename>). Stop and start Apache to activate the
changes.
</para>

</section>
</section>

<section id="setup_windows_mysql">
<title>Installing MySQL</title>

<para>Unzip the MySQL zip file to a temporary place and run the setup
file (Setup.exe). You will meet an easy to use installation wizard.
Press Next, Next and accept standard installation path. Chose Ok,
Next, Typical followed by Next and wait while the setup - program
copies the files. Press Finish after the setup is completed.
</para>

<para>MySQL will normally automatically start under the boot of the
PC. You can also start the service manually with running
Winmysqladmin.exe from the \bin folder where MySQL is
installed.
</para>

<para>When MySQL is running you will see a "green light" beside the
clock in right bottom corner. The first time you run Winmysqladmin you
will sometimes get a question about username and password. Assign a
username and password you manage to remember. If you don't get the
question MySQL will use the username and password you use to log into
Windows.
</para>
</section>

<section id="setup_windows_mgw">
<title>Installing Moregroupware</title>

<para>Unzip and move the Moregroupware - folder you have downloaded to
<filename>C:\web\moregroupware</filename>. In
<filename>C:\web\moregroupware</filename> you shall now find some
folders (docs, include, modules etc.) and also the file
<filename>index.php</filename>.
</para>

<para>Now it is time to make an empty MySQL database which
Moregroupware can "populate" with data. Start Winmysqladmin and choose
Databases. Press right mouse button inside the white databases window
and choose Create Database. Give your database a name (e. g. MGW) and
press Create the Database.  Choose Environment and Hide me to hide
away the WinMySQLadmin - window.
</para>

<para>Start your web - browser and open the web - page
<literal>http://yourPCname/moregroupware/setup/index.php</literal>
Choose Language to use under the installation and press Next. You will
now get a web - page with many setup - choices where you shall use the
following values (the <link linkend="setup_setup">setup is described here in full detail</link>):

<itemizedlist>
<listitem>
<para>Databaseproduct: Choose MySQL</para>
</listitem>
<listitem>
<para>Database Hostname / IP: localhost or IP - address (use localhost and not real PC name here)</para>
</listitem>
<listitem>
<para>Database User: The username you defined in Winmysqladmin</para>
</listitem>
<listitem>
<para>Database Password: The password you defined in Winmysqladmin</para>
</listitem>
<listitem>
<para>Name of database: The database - name you defined in Winmysqladmin (e. g. MGW).</para>
</listitem>
<listitem>
<para>URL to moregroupware root: http://yourPCname/moregroupware</para>
</listitem>
<listitem>
<para>System path to moregroupware: c:\web\moregroupware</para>
</listitem>
<listitem>
<para>Theme of moregroupware: default</para>
</listitem>
<listitem>
<para>Authentication method: SQL</para>
</listitem>
<listitem>
<para>Directory type, LDAP etc.: Use the default choices. Most of the LDAP fields are empty by default.</para>
</listitem>
</itemizedlist>
</para>

<para>Press Next. Choose which modules you wish to install and yet
another time press Next.
</para>

<para>Cross your fingers and hope for the best. If you are lucky you
will get a message which says: Installation successful! Point your web
browser to
<literal>http://yourPCname/moregroupware/index.php</literal>
</para>

<para>You are ready to log into Moregroupware for the first time! Use
user "admin" and password "admin" for first time login.
</para>

<para>Good luck with your Moregroupware - installation!</para>

</section>

<section id="setup_windows_troubleshooting">
<title>More support and help</title>

<para>You will find more information about the installation of Apache,
PHP and MySQL at the web - page <ulink url="http://www.net-language.com/workshops/Default.asp?Workshop=21&amp;step=1">http://www.net-language.com/workshops/Default.asp?Workshop=21&amp;step=1
</ulink>
</para>

</section>

</chapter>
